Hi,
Can u plz explain me details.
Can u plz send me step by step how to do it ?
Coz i tried following code but it is not woking so. Can u plz tell me wat's the wrong in this code ?
<UserControl x:Class="SilverlightApplication1.Page"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="400" Height="300">
<Grid x:Name="LayoutRoot" Background="White">
<StackPanel Grid.Row="1" Margin="20,10,20,10" Background="White" Visibility="Visible">
<MediaElement x:Name="moviePlayer" Source="mdlib.wmv" Margin="5">
</MediaElement>
<Slider x:Name="timeline" ValueChanged="timeline_ValueChanged" Maximum="1" Margin="5" >
</Slider>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<Button x:Name="movieStop"
Content="Stop" Height="25" Width="40" Click="movieStop_Click" Margin="5">
</Button> <ToggleButton x:Name="moviePlay" Content="Play" Height="25" Width="40" Click="moviePlay_Click" Margin="5">
</ToggleButton> <CheckBox x:Name="movieMute" Content="Sound On" Click="movieMute_Click">
</CheckBox>
</StackPanel>
</StackPanel>
</Grid>
</
UserControl>
private void timeline_ValueChanged(
object sender, RoutedPropertyChangedEventArgs<double> e)
{
long ticks = (long)((sender as Slider).Value *
this.moviePlayer.NaturalDuration.TimeSpan.Ticks);
TimeSpan movieTimespan = new TimeSpan(ticks);
this.moviePlayer.Position = movieTimespan;
if (this.moviePlayer.CurrentState == MediaElementState.Playing)
{
this.moviePlay.IsChecked = true;
this.moviePlay.Content = "Pause";
}
}
private void movieStop_Click(object sender, RoutedEventArgs e)
{
this.timeline.Value = 0;
this.moviePlayer.Stop();
this.moviePlay.Content = "Play";
}
private void moviePlay_Click(object sender, RoutedEventArgs e)
{
if (moviePlay.IsChecked == true)
{
moviePlay.Content =
"Pause";
this.moviePlayer.Play();
}
else
{
moviePlay.Content =
"Play";
this.moviePlayer.Pause();
}
}
private void movieMute_Click(object sender, RoutedEventArgs e)
{
if (movieMute.IsChecked == true)
{
movieMute.Content =
"Sound On";
this.moviePlayer.IsMuted = true;
}
else
{
movieMute.Content =
"Sound Off";
this.moviePlayer.IsMuted = false;
}
}
thnks