我试图在点击一个按钮然后播放媒体时给MediaElement一个源,这是我到目前为止所做的:
在我的XAML中:
<MediaElement x:Name="vid" HorizontalAlignment="Left" Height="100" Margin="310,193,0,0" Grid.Row="1" VerticalAlignment="Top" Width="100" Source="Assets/Stars.mov"/>
在课堂上:
private void Button1_Click(object sender, RoutedEventArgs e)
{
this.vid.Source = new Uri("Assets/Stars.mov", UriKind.Relative);
vid.Play();
}
但是我收到此错误:
An exception of type 'System.ArgumentException' occurred in mscorlib.dll but was not handled in user code
Additional information: The given System.Uri cannot be converted into a Windows.Foundation.Uri. Please see http://go.microsoft.com/fwlink/?LinkID=215849 for details.
有谁知道我做错了什么?