Im trying to play a wmv video on the home page of a Silverligh Navigation Application, but it won't start playing. I've stored the file in the clientbin folder and changed the build action to resource.
<Canvas Name="Holder" Width="350" Height="220" Background="Black">
<MediaElement Name="Video" AutoPlay="True" Volume="100" Source="vid.wmv"/>
</Canvas>
Additionally I've tried making a button and add a Video.Play() method but still no luck... When I play the file using WMP it works perfect.
Any ideas?
Thanks
There's quite probably an exception being thrown while attempting to load the video. Add a handler to the MediaFailed event of your MediaElement and see what the exception you get from inside the ExceptionRoutedEventArgs parameter is.
Related
Code:-
<ReactPlayer url="https://drive.google.com/uc?export=download&id=1JOZBkMwOllSNg7ameXnAj1dlagusMeux" controls={true} />
I have already changes the permission to public and editor.
But this url not working for larger size.
Can somebody help, how to make it working.
Thank You.
since the link doesn't point to a video file as it's a download link you cannot use react-player.
google drive allows you to embed items
use
<iframe src="https://drive.google.com/file/d/1JOZBkMwOllSNg7ameXnAj1dlagusMeux/preview" width="640" height="480" allow="autoplay"></iframe>
I have some icons in my WPF project to make the application more user friendly. WPF shows all icons on my computer but when I run the app on other computers it will show some of icons but not all of them. How can I fix it?
Update:
<Image Source="Office/Add-Female-User.ico" Stretch="None" />
I'm sure that all images are accessible because some of them are visible.
You are referencing your images (in your image controls) as Content not Resource. I suspect the problem is your images aren't copied to the output dir. View properties on missing image files and set build action to Content and Copy to output dir to Copy if newer.
For resource referencing see http://msdn.microsoft.com/en-us/library/aa970069.aspx.
How to determine that UserControl has been loaded completely?
I have some UserControls with images and media files from another server bound like that:
<Image Source="{Binding Image}" />
I would like to know when all my images are downloaded and ready to be shown.
I've noticed an event ImageLoaded, and probably I can listen to it on all of my Image controls. Isn't there a better way to do that?
The class FrameworkElement contains a public event called "Loaded", so naturally all classes derviving from it (UserControl class) expose it as well.
MSDN
The question would be : Are you downloading your images ? (This can be after loading of the control Check here) Or are you embedding your images in the project? They'll be a part of the .xap file that's downloaded when you launch your application.
You can add an event handler to that event to execute code when the said event occurrs. Hope that helps.
Because I want to do things like load images from the web (see this post). To see this in action try creating a Silverlight Project without a website and with a website and past the following into the main page. On the web project things work as expected, in the file based project you get a white screen.
<Grid x:Name="LayoutRoot" Background="White">
<ListBox>
<ListBoxItem>
<Image Source="http://sstatic.net/so/img/logo.png"/>
</ListBoxItem>
<ListBoxItem>
<Image Source="http://sstatic.net/so/img/logo.png"/>
</ListBoxItem>
<ListBoxItem>
<Image Source="http://sstatic.net/so/img/logo.png"/>
</ListBoxItem>
<ListBoxItem>
<Image Source="http://sstatic.net/so/img/logo.png"/>
</ListBoxItem>
</ListBox>
</Grid>
So I guess I need to move my Silverlight project from using a default file to an http accessible location. How do I move my development files to a website and still be able to compile, debug, etc from Visual Studio. Is the only way to do this create a new Solution as web project and go and Add everything to it?
When you add a Silverlight project to your ASP.NET project it will generate two test pages: one in aspx and one in html.
For a non-ASP.NET website use the html file and everything that it references such as Silverlight.js and the ClientBin directory.
ASP.NET is not required for hosting Silverlight.
I created a new Silverlight project with an ASP net application and used that as my Web application base (copying it to the old Solutions directory and adding it to the Solution). Setting the Web Applicaiton to the starting project and a quick edit to the Silverlight Applications tab of the properties and everything worked. I just take the .html page and the xap from the ClientBin to move it to a live website, and images are working perfectly.
I added a bunch of images as project resources.
Now i want to use them in my WPF application using the image control.
How can I assign the resource to the source of the image control?
First, mark you image file as a "Resource" in the properties window of Visual Studio. Then you can quite easily reference the resource using the file name:
<Image x:Name="image1" Source="theimage.png" />
If you have put your image in a folder, you can use
<Image x:Name="image1" Source="/folder/theimage.png" />
You wanted to reference your image in XAML right?
like this
<Image Source="Resources\MyImage.png" />
and you dont need to add the image to the project resource. just add the images to your project via solution explorer