Mega Code Archive

 
Categories / VB.Net Tutorial / WPF
 

Play wmv file with MediaTimeline

<Grid    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"   xmlns:d="http://schemas.microsoft.com/expression/interactivedesigner/2006"   mc:Ignorable="d" x:Name="DocumentRoot" x:Class="SampleExpressionProject.VideoScene" Width="640" Height="480">   <Grid.Resources>     <Storyboard x:Key="OnLoaded">       <MediaTimeline d:DesignTimeNaturalDuration="288" Source="tv.wmv" BeginTime="00:00:00" Storyboard.TargetName="wmv"/>     </Storyboard>   </Grid.Resources>   <Grid.Triggers>     <EventTrigger RoutedEvent="FrameworkElement.Loaded">       <BeginStoryboard x:Name="OnLoaded_BeginStoryboard" Storyboard="{DynamicResource OnLoaded}"/>     </EventTrigger>   </Grid.Triggers>      <Grid.ColumnDefinitions>     <ColumnDefinition/>   </Grid.ColumnDefinitions>   <Grid.RowDefinitions>     <RowDefinition/>   </Grid.RowDefinitions>   <MediaElement Width="320" Height="240" x:Name="wmv" d:IsScrubbingEnabled="True">   </MediaElement> </Grid>