|
You can use OnRender although when you get used to it, WPFs other methods are usually preferable. Silverlight doesn't support hosting Windows Forms controls, I don't know if XBAPs do. While they share quite a lot Silverlight doesn't support everything that WPF does and other parts are work differently.
|
|
|
|
|
Hmm, it doesn't look like I can use OnRender; when using Silverlight, it doesn't seem to exist in UIElement, and the class System.Windows.Media.DrawingContext doesn't exist at all...
EDIT: Yeah, DrawingContext is in PresentationCore.dll, which cannot be added to a Silverlight project because "it was not built against the Silverlight runtime."
[Insert witty and relevant signature here]
|
|
|
|
|
Hi,
We're using SL v1 to play a video streams from a Window Media server. We had no problems when we were using windows media player to play this video, but when using SL, the time slider causes a long pause, very slow rendering the video.
Has anyone solved this problem?
Are there any good sample implementations that someone could point me to?
Thanks.
Shefali
|
|
|
|
|
Hi,
Were you able to resolve this?
I have implemented Silverlight players using "MediaElement" (embedded as part of main Page xaml) as well as the "MediaPlayer" (separate Silverlight control) and both exhibit the same symptoms i.e. playing audio and video slowly. In the case of audio it seems to be repeating three times as it progresses.
Any guidance appreciated!
Thanks,
Alan
|
|
|
|
|
I've been playing with the WPF hands-on lab from the Chicago 'Heroes Happen Here' event a month or so ago. The lab is on line here, but the source code files for the lab aren't there. It's a good lab, and I'd like to study the source code and markup.
Does anyone know whether these source code files are available? If so, where are they posted?
Thanks!
David Veeneman
www.veeneman.com
|
|
|
|
|
Yes via MS site ::
Visual Studio 2008 and .NET Framework 3.5 Training Kit
File Name: VisualStudio2008TrainingKit.exe
Version: 1.0
Date Published: 11/30/2007
Language: English
Download Size: 125.9 MB
http://www.microsoft.com/downloads/details.aspx?FamilyID=8BDAA836-0BBA-4393-94DB-6C3C4A0C98A1&displaylang=en
Got Slack?
|
|
|
|
|
Hi,
does anybody knows what is the WPF way to avoid Tab Selection?
in WinForms i had the Selecting event which i could cancel (with CancelEventArgs)
btw, is there any source of the net that gives you the deifferences?
i found this great document:
Wpf for those who knows WinForms[^]
But it doesn't cover everything, just Layouts, Binding and some general issues (Form Vs Window etc.)
i would love to get other sources like that
thanks,
|
|
|
|
|
Read up on Preview events and the cancelling of them. This code in effect cancels the mouse click so that the tab selection will not take place.
You can get access to the tabitem that was click from the e.OriginalSource and then perform you logic to cancel the mouse click or not.
Private Sub tcOpenPages_PreviewMouseLeftButtonDown(ByVal sender As Object, _
ByVal e As System.Windows.Input.MouseButtonEventArgs) _
Handles tcOpenPages.PreviewMouseLeftButtonDown
Dim bolCancelTabSelection As Boolean = False
'write some code to set bolCancelTabSelection
If bolCancelTabSelection Then
e.Handled = True
End If
End Sub
modified 27-Feb-21 21:01pm.
|
|
|
|
|
I believe you should be able to use SelectionChanged event of TabControl. Such as-
--------------------------
void tb1_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (e.RemovedItems[0] == TbPage1)
{
MessageBox.Show("");
}
//throw new NotImplementedException();
}
-------------------------
-Ajay.
-------------------------
www.componentone.com
-------------------------
|
|
|
|
|
but in SelectionChanged you can't cancel the selection, only add stuff to when it's happening
|
|
|
|
|
Hi all,
I am planning to develop a website which have a simulator where allows users to design thier nail design online. This will be something drag and drop the design to the fingernail in 3D mode,decoration the nail and also display the nail design gallery in 3D which is fully interactive.
I do not want to choose Flash is because it just align the timeframe and simple coding. I want algorithm in my program and it is quite challenge to me to learn.
I posted on C# forum and others as well and they suggest me to use Silverlight. Do anyone have any website related to the Silverlight?Is Silverlight involved algorithm?
Thanks.
|
|
|
|
|
|
Hi all,
I am planning to develop a website which have a simulator where allows users to design thier nail design online. This will be something drag and drop the design to the fingernail in 3D mode.
I would like to ask can this implement in C# with Managed DirectX? And, how do I implement this using C# wi9th Managed DirectX?
Thanks.
|
|
|
|
|
Yes folks, this guy did indeed post this to every forum we have.
Ironically, if you use Silverlight to do this, ( and you probably will ), WPF will be involved.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi All,
I'm still very much a newbie to a lot of C# / WPF and i'm having a bit of trouble making this 'generic' animation type work for me, but I also can't see what the problem is. I've been looking at the code for what already feels like a lifetime and I've gotten nowhere so I'm here now asking silly questions. Sorry for the stack of code below btw.
When I do this:
public void FadeElement(string ElementName, double currentOpacity, double targetOpacity)
{
Storyboard Fade = new Storyboard();
TimeSpan duration = new TimeSpan(0, 0, 0, 0, 500);
DoubleAnimation animation = new DoubleAnimation();
animation.From = currentOpacity;
animation.To = targetOpacity;
animation.Duration = new Duration(duration);
Storyboard.SetTargetName(animation, ElementName);
Storyboard.SetTargetProperty(animation, new PropertyPath(Control.OpacityProperty));
Fade.Children.Add(animation);
Fade.Begin(this);
}
All works fine.
But I wasn't to 'wrap' this up in a type in a separate library in order to enable me to re-use over and over without having this method in every app I/we make so I did this:
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media.Animation;
namespace Utils.HelperClasses.WPF
{
public sealed class OpacityAnimation : Storyboard
{
#region Fields and Properties
private Storyboard _storyboard;
public string ElementName;
public double CurrentOpacity;
public double TargetOpacity;
public OpacityAnimation()
{
}
public Storyboard CreateOpacityAnimation()
{
_storyboard = FadeElement(ElementName, CurrentOpacity, TargetOpacity);
return _storyboard;
}
private Storyboard FadeElement(string elementName, double currentOpacity, double targetOpacity)
{
Storyboard Fade = new Storyboard();
TimeSpan duration = new TimeSpan(0, 0, 0, 0, 500);
DoubleAnimation animation = new DoubleAnimation();
animation.From = currentOpacity;
animation.To = targetOpacity;
animation.Duration = new Duration(duration);
Storyboard.SetTargetName(animation, elementName);
Storyboard.SetTargetProperty(animation, new PropertyPath(Control.OpacityProperty));
Fade.Children.Add(animation);
return Fade;
}
#endregion
}
}
but then running this code does nothing but as far as I can tell its more or less the same as doing just the method in the first example with some code abstracted away in the other library:
private void button1_Click(object sender, RoutedEventArgs e)
{
OpacityAnimation oa = new OpacityAnimation();
oa.CurrentOpacity = 1;
oa.ElementName = "button2";
oa.TargetOpacity = 0.3;
oa.CreateOpacityAnimation();
oa.Begin(this);
}
Can anyone offer some insight into what I'm overlooking here?
Thanks,
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
I started work on something similar using attached properties e.g <Button t:Transition.LoadedTransition="FadeIn" >Button</Button> I then found that markup extensions could not be used for events and I didn't want to create a property for each event, although I think there are a few workarounds. I haven't checked it out yet but the Transitionals project might provide similar functionality. Edit: Also see Kevin's WPF Bag-o-Tricks.
Anyway, with your code I found the problem was that you were inheriting from Storyboard and also creating another inside it and they must have got jumbled up.
public Storyboard CreateOpacityAnimation()
{
FadeElement(ElementName, CurrentOpacity, TargetOpacity);
return this;
}
private void FadeElement(string elementName, double currentOpacity, double targetOpacity)
{
TimeSpan duration = new TimeSpan(0, 0, 0, 0, 500);
DoubleAnimation animation = new DoubleAnimation();
animation.From = currentOpacity;
animation.To = targetOpacity;
animation.Duration = new Duration(duration);
Storyboard.SetTargetName(animation, elementName);
Storyboard.SetTargetProperty(animation, new PropertyPath(Control.OpacityProperty));
Children.Add(animation);
}
You could however just create a static method and reduce the amount of code needed e.g.
public static class Animations
{
public static void Fade(this UIElement control,double targetOpactity,int milliseconds)
{
control.BeginAnimation(UIElement.OpacityProperty,new DoubleAnimation(targetOpactity,new Duration(TimeSpan.FromMilliseconds(milliseconds))));
}
}
private void Button_Click(object sender, RoutedEventArgs e)
{
button2.Fade(0.3,500);
}
If your not using C# 3.0 or don't want to use an extension method thats a simple change.
modified on Friday, May 2, 2008 5:51 PM
|
|
|
|
|
Hi Dave,
Fantastic! I'm going to have a good play with this tomorrow. I still don't fully understand inheritace so I had no idea that creating my class would also create a Storyboard.
Thanks for all this info, incredibly useful.
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
public static class Animations
{
public static void Fade(this UIElement control,double targetOpactity,int milliseconds)
{
control.BeginAnimation(UIElement.OpacityProperty,new DoubleAnimation(targetOpactity,new Duration(TimeSpan.FromMilliseconds(milliseconds))));
}
}
This is genius!
I take it this is also working along the lines of WPF's handoff animations in that it doesn't care what the current opacity is and will simple animate to the target opacity from its current opacity setting.
Food for thought! Thanks!
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
Hi All,
I'm just creating some UI elements and I have an expander control in the UI that I wish to be able to expand ON TOP of all other content when its expanded and contract back to its 'placeholder' position when collapsed.
I've actually already done this one in another app (but that the code has been decimated by other developers ...) and I can't seem to replicated this behaviour again.
I've tried putting it into another layer and i've tried editing the ZIndex but none have worked ...
Any tips out there in WPF land?
Cheers,
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
Great ... now I'm also talking to myself.
Fixed.
I was a dunce!
Caught out by an explicit height setting in the user control!!! I have now got the control working as desired!
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
I have install following components in my stem
Silverlight.2.0
silverlight_sdk
VS_SilverlightTools_Alpha_Setup
now when i am opening Sliverlights project i have getting errror :
Package Load Failure......
can any one help me ?
Thanks in Advance
Best Regards
-----------------
Abhijit Jana
"Success is Journey it's not a destination"
|
|
|
|
|
my problem has been solved. my VS_SilverlightTools_Alpha_Setup vesrion was older.
Thanks @@@@@
Best Regards
-----------------
Abhijit Jana
"Success is Journey it's not a destination"
|
|
|
|
|
The source for Silverlight 2 controls has been released with thousands of unit tests along with the test framework. That said, to develop Silverlight-based applications that use the Silverlight 2 Beta 1 controls, you do not need this source code. Instead, you must install the Silverlight 2 Software Development Kit (SDK) Beta 1. The source code for the Silverlight 2 Beta 1 controls enables you to learn the inner workings of the controls. To get the source code and tests, see Source Code and Unit Tests for Silverlight 2 Beta 1 Controls on Microsoft download site.
The download is useful if you want to extend the controls or use them as a reference implementation when you implement your own controls. Complete unit tests provide additional guidance in developing polished, professional controls.
This download contains the complete source code and unit tests for the Silverlight 2 Beta 1 controls included in System.Windows.Controls.dll, System.Windows.Controls.Extended.dll, and System.Windows.Controls.Data.dll.
The source code for the Silverlight 2 Beta 1 controls includes implementations for the following controls:
- Button
- ButtonBase
- Calendar
- CheckBox
- ContentControl
- DataGrid
- DatePicker
- GridSplitter
- HyperlinkButton
- ListBox
- RadioButton
- RangeBase
- RepeatButton
- ScrollViewer
- Slider
- ToogleButton
- ToolTip
- WatermarkedTextBox
|
|
|
|
|
I wonder why MS doesn't want to show the sourcecode for Textbox.
|
|
|
|
|
Hi All;
[Edited to include link to mentioned tutorial]
I am trying out Scott Guthrie's Silverlight tutorial and got stuck in a rut. I cannot find any details around.
When I query DIGG on 'car', 'cars', 'sport'....I get an error (described later), while if I query 'space', 'baseball', 'microsoft' I get expected XML. Just does not make sense.
The Exception is:
System.Reflection.TargetInvocationException
Inner Exception: System.Exception: Download Failure.
Tnx to all
Ian
No trees were killed in the creation of this message. However, many electrons were terribly inconvenienced.
modified on Thursday, May 1, 2008 4:45 PM
|
|
|
|