Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
列表框包含图像,分配给列表框的对象具有相应的 wmv 文件路径。如何通过 {binding} 将所选路径绑定到媒体元素。
吉萨。
可以使用 ElementName 设置绑定源到列表框,然后绑定到 SelectedItem 的一个属性:
<ListBox Name="imageListBox" ... /> <MediaElement Source="{Binding ElementName=imageListBox, Path=SelectedItem.WmvPath}"/>