|
You need to use a proper URI for the MediaElement Source.
If you use
Source="a_video.wmv"
then that's a relative URI so a_video.wmv needs to be in your Silverlight
app's XAP. You could add the file to your project and set its Build
Action to "Content" and set Copy to Output Directory to copy the file.
For local files you need an absolute URL, something like
Source="File://c:/somefolder/a_video.wmv"
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
thank you its working now I added reference to my video in app's XAP folder.
I used the Relative URI source='/a_video.wmv'
I have one doubt here I created silvetlight project now i want to create webapplication and i want to use silverlight media elements etc and for web application where i have to place my video to play.
please help me if you know and how to host silverlight projects?
|
|
|
|
|
pavanip wrote: where i have to place my video to play
Depends on your requirements.
You can place the files anywhere they are accessible by URI, or bundled
with the application.
You may not want to deliver large media in your app because the user would
have to wait for it to download before the app even runs. You could, however,
make a separate xap to hold media resources.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
Prajeesh wrote:
What is Image.Thumbnail ?
Do you think the information you have provided is sufficient for someone to understand your issue ?
|
|
|
|
|
I'm a bit confused as to what you want to do here. Do you expect this to show
a thumbnail of all of the images
multiple thumbnails - one per image
multiple thumbnails - one image
If you expect multiple thumbnails, then you need to wrap this up into a ListBox (or similar).
|
|
|
|
|
In some PC games, such as Civilization, the world map appear as a whole undeveloped territory with black mask. Along with your movement, the world map reveal itself gradually.
Now I'm trying to make the same effect using wpf. To predigest the question I use a Canvas(Background = Black) instead of the world map, a Small Rectangle with a storyboard to move itself along Canvas.LeftProperty and Canvas.TopProerty. How could I make the Canvas reveal itself along the track of the rectangle???
|
|
|
|
|
The Clip and OpacityMask properties allow you to mask areas. The OpacityMask is the most powerful you could set it to a VisualBrush which animates.
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
Background = Brushes.Black;
var content = new Canvas() { Background = Brushes.Orange };
var mask = new Canvas() { Width = 300, Height = 300,Background = Brushes.Transparent};
var rectangle = new Rectangle() { Width = 0, Height = 300, Fill = Brushes.White };
mask.Children.Add(rectangle);
var brush = new VisualBrush(mask) { AutoLayoutContent = true };
var anim = new DoubleAnimation(300, TimeSpan.FromSeconds(3));
rectangle.BeginAnimation(Rectangle.WidthProperty, anim);
content.OpacityMask = brush;
Content = content;
}
}
|
|
|
|
|
Hello everyone,
I created a DragCanvas (based on DraggingElementsInCanvas[^]) and I use to display ObservableCollection of items (like this msdn forums[^]).
However I have two ObservableCollection's which I want to display:
- collection of network nodes
- collection of connections/links between this nodes (each connection has DataBinding to two Nodes{.Left,.Top})
It is possible to have two ItemSources for such a control? What would be the best solution to display these two collections?
Thanks in advance.
|
|
|
|
|
For me, the links are also nodes of a certain type. If you have them all in one collection then, you can use the DataTemplateSelector. Take a look here[^] and here[^] and see if I make sense.
|
|
|
|
|
Thanks for your answer. The DataTemplateSelector is great. However in my data model, the links and nodes are seperated in two ObservableCollections because later on I want to filter them using ICollectionView. The user can choose that for example only blue nodes and red links should be displayed. Perhaps this can be also solved using DataTemplateSelector as you recommended but I have some difficulties to put it all together. Can you give me another hint where to look? Thank you.
|
|
|
|
|
You could still use the ICollectionView on the observable collection. MSDN and the link I gave you had good samples, you can google out for more.
|
|
|
|
|
How can i dynamically add images in wpf ? i suppose it should be simple , but i just can't find the answer..
Thank you !
|
|
|
|
|
Image myImage = new Image();
myImage.Width = 200;
BitmapImage myBitmapImage = new BitmapImage();
myBitmapImage.BeginInit();
myBitmapImage.UriSource = new Uri(@"C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Water Lilies.jpg");
myBitmapImage.DecodePixelWidth = 200;
myBitmapImage.EndInit();
myImage.Source = myBitmapImage;
From here[^]
You would then add myImage to the container where you want to show it.
|
|
|
|
|
Hello,
I am trying to trap the click event for a button that is in the resourcedictionary,
I get a error
WpfApplication1.MyResourceDictionary' does not contain a definition for 'GetTemplateChild' and no extension method 'GetTemplateChild' accepting a first argument of type 'WpfApplication1.MyResourceDictionary' could be found (are you missing a using directive or an assembly reference?)
MyResourceDictionay.xaml.cs looks like this
namespace WindowsApplication1
{
partial class MyResourceDictionary
{
public virtual void OnApplyTemplate()
{
Button myButton = this.GetTemplateChild("Crap") as Button;
}
}
}
MyResourceDictionay.xaml looks like this
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="MyResourceDictionary"
x:ClassModifier="public">
<ControlTemplate x:Key="ExpandablePropertyEditorTemplate">
<Button x:Name="Crap" Foreground="White" Background="White">
<Image Source="Controls\check.png"/>
</Button>
</ControlTemplate>
</ResourceDictionary>
Any help?
|
|
|
|
|
|
Hello,
it is possible to make something like a MDI-Application in WPF? Or run a process and get the WPF-Controls of the main window in a control?
I want to make a "plug-in-based" application, and it shouldn't everytime show a new window, i want to have them in my main-application. How is something to do?
|
|
|
|
|
You could have each one open in a new tab. While it is possible to write MDI in WPF, it's a nasty hack because WPF wasn't designed this way.
|
|
|
|
|
Yes in a tab is ok, but how can i do this?
|
|
|
|
|
You'd create these "applications" as plug-ins that your application would use. Have a look at the Managed Extensibility Framework to get some ideas.
|
|
|
|
|
Good People,
I have an object that will hold data and bind to some controls. Sometimes it will just need to exist as one object, other times it will need to exist in a collection. In your opinion, what strategy should/can I use:
1) implement INotifyPropertyChanged on the object, and when needed, place it in the observable collection.
2) simply implement the object normally - without INotifyPropertyChanged - and then place it in the observable collection which will update any properties
By the way, is it possible to use INotifyPropertyChanged and place such objects in an ObservableCollection?
Thank's so much for any help or information you can provide.
Blitz
|
|
|
|
|
Use strategy 1. The ObservableCollection tells you when the collection has changed not when a property of an object inside it has changed.
|
|
|
|
|
Awesome! Thanks Pete. Appreciate you sharing your insight.
|
|
|
|
|
No problem mate. Always glad to help.
|
|
|
|
|
I want to set the default styling in some controls and want to set all properties in generic.xaml.
I am looking at folowing link
http://www.codeproject.com/KB/silverlight/mediabutton.aspx[^]
but if change some property for example
<Setter property="Cursor" Value="Arrow" />
to
<Setter property="Cursor" Value="Hand" />
Its not getting reflected when I run the application.
No idea why? Does anybody have any idea? I have done a lot of brainstorming but not able to find........
Thanks in advance,
|
|
|
|