XAML
<Grid x:Name="LayoutRoot" Background="White">
<Canvas x:Name="VideoCanvas" Width="800" Height="600" AllowDrop="True" Background="RosyBrown" HorizontalAlignment="Center">
<StackPanel Drop="VideoCanvas_Drop" AllowDrop="True" Name="CommandBar" Orientation="Horizontal" Background="Beige" Height="39" Width="783" Margin="5" HorizontalAlignment="Center" Canvas.Left="3">
<Button Name="PlayMovie" Background="AntiqueWhite" Content="Play" FontWeight="Bold" Click="PlayMovie_Click" Margin="50,5,0,5" Width="100"/>
<Button Name="PauseMovie" Background="AntiqueWhite" Content="Pause" FontWeight="Bold" Click="PauseMovie_Click" Margin="50,5,0,5" Width="100"/>
<Button Name="VideoStop" Background="AntiqueWhite" Content="Stop" FontWeight="Bold" Click="VideoStop_Click" Margin="50,5,0,5" Width="100" />
</StackPanel>
<MediaElement x:Name="mediaEl" Canvas.Top="150" Width="800" Height="450" AllowDrop="True" AutoPlay="True" />
</Canvas>
</Grid>
C#
private void VideoCanvas_Drop(object sender, DragEventArgs e)
{
DragEventArgs dr = e as DragEventArgs;
if (dr.Data == null)
return;
IDataObject data = dr.Data;
FileInfo[] file = data.GetData(DataFormats.FileDrop) as FileInfo[];
if (file.Count() > 0)
mediaEl.SetSource(file[0].OpenRead());
if (mediaEl.CurrentState != MediaElementState.Playing)
{
mediaEl.Play();
}
}