是否有办法在不点击按钮的情况下启动视频(媒体元素)?
所以我的意思是从Binding背后的代码或类似的东西?
<Grid Background="Black" Width="{Binding Shape.Width}" Height="{Binding Shape.Height}">
<Grid.Triggers>
<EventTrigger ...>
<EventTrigger.Actions>
<BeginStoryboard Name="beginStoryboard">
<Storyboard>
<MediaTimeline Source="C:\riskpart1.wmv" Storyboard.TargetName="video" />
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</Grid.Triggers>
<MediaElement x:Name="video" LoadedBehavior="Play" />
</Grid>
答案 0 :(得分:1)
<EventTrigger RoutedEvent="Window.Loaded">