开发者

Set Mediaelement Source to Relative URI in WPF Code

开发者 https://www.devze.com 2023-02-21 16:40 出处:网络
I have a project that is WPF4 and VB.net. I\'m trying to set a mediaelement\'s source using a mediatimeline (inside a storyboard construct), so I can loop the mediaelement. However, I cannot figure ou

I have a project that is WPF4 and VB.net. I'm trying to set a mediaelement's source using a mediatimeline (inside a storyboard construct), so I can loop the mediaelement. However, I cannot figure out how to set开发者_高级运维 the source to a relative URI in WPF. I know how to do it in VB.net, but by setting the source there, I can't have the media looping.

How do I set the source of a mediaelement in a mediatimeline to a relative URI?


See the MSDN reference to the MediaElement.Source property. Make sure the media file property "Copy To Output" is set to "Copy Always" or "Copy If Newer".

Example:

<MediaElement x:Name="xyzName" Width="Auto" Height="Auto" Source="MediaFolder/YourMediaFile.mov" />
0

精彩评论

暂无评论...
验证码 换一张
取 消