MediaElement原始的播放是只播放一遍;如何设置让MediaElement播放 的视频或者音频循环播放,解决如下:
修改MediaElement模版
<MediaElement Name="myMediaElement" Margin="13,35,14,0" Height="100" VerticalAlignment="Top">
<MediaElement.Triggers> <EventTrigger RoutedEvent="MediaElement.Loaded"> <EventTrigger.Actions> <BeginStoryboard> <Storyboard> <MediaTimeline Source="banner[2].avi" Storyboard.TargetName="myMediaElement" RepeatBehavior="Forever" /> </Storyboard> </BeginStoryboard> </EventTrigger.Actions> </EventTrigger> </MediaElement.Triggers> </MediaElement>
红色标注的是多媒体文件的路径;