I am trying to get a video to repeat forever using MediaElement. I found the code below http://msdn.microsoft.com/en-us/library/ms741866.aspx and it works great.
<MediaElement Name="myMediaElement" > <MediaElement.Triggers> <EventTrigger RoutedEvent="MediaElement.Loaded"> <EventTrigger.Actions> <BeginStoryboard> <Storyboard> <MediaTimeline Source="C:\MyVideo1.wmv" Storyboard.TargetName="myMediaElement" RepeatBehavior="Forever" /> </Storyboard> </BeginStoryboard> </EventTrigger.Actions> </EventTrigger> </MediaElement.Triggers> </MediaElement>
The problem I am facing is when I try to link MediaTimeLine to an xml source. I get an error - "Be sure to specify a URI."
<MediaTimeline Source="{Binding XPath=MyVideos}" Storyboard.TargetName="myMediaElement" RepeatBehavior="Forever" />
Is there a C # solution that could replace xaml?
c # wpf mediaelement
Kens
source share