C# 如何通过将源绑定到XPath在WPF中使用MediaElement?

C# 如何通过将源绑定到XPath在WPF中使用MediaElement?,c#,wpf,xaml,mediaelement,C#,Wpf,Xaml,Mediaelement,我试图使用标准WPF MediaElement从XML数据源提供的路径播放文件 因此,XML元素看起来像: <Video Path="MediaFiles/Videos/video1.mp4" /> 我做错了什么?您尝试过清洁和重建解决方案吗?不仅仅是这个!我也得到这个后,电脑重新启动。。。 <DataTemplate x:Key="Imagetemplate"> <MediaElement Source="{Binding XPath=@Path}" W

我试图使用标准WPF MediaElement从XML数据源提供的路径播放文件

因此,XML元素看起来像:

<Video Path="MediaFiles/Videos/video1.mp4" />

我做错了什么?

您尝试过清洁和重建解决方案吗?不仅仅是这个!我也得到这个后,电脑重新启动。。。
<DataTemplate x:Key="Imagetemplate">
    <MediaElement Source="{Binding XPath=@Path}" Width="50" Height="100"/>
</DataTemplate>
Error       Object reference not set to an instance of an object.