【发布时间】:2010-09-06 10:36:36
【问题描述】:
我正在尝试将自定义对象列表绑定到 WPF 图像,如下所示:
<Image>
<Image.Source>
<BitmapImage UriSource="{Binding Path=ImagePath}" />
</Image.Source>
</Image>
但它不起作用。这是我得到的错误:
“必须设置属性 'UriSource' 或属性 'StreamSource'。”
我错过了什么?
【问题讨论】:
-
不幸的是,答案中没有解释失败的实际原因。请参阅this(无论出于何种原因,WPF/XAML 都不支持将 Uri 对象直接绑定到 BitmapImage 对象的 UriSource。运行时,应用程序会失败并出现错误,)跨度>
标签: .net wpf data-binding xaml