【发布时间】:2016-04-17 11:35:17
【问题描述】:
我有一个问题 - 我想将一个作为 ObservableCollection 的类属性绑定到 GridView。
类代码:
public class Moment
{
...
public ObservableCollection<Uri> PhotoFilePath { get; set; }
}
XAML
<GridView Grid.Row="0"
Name="PhotosGridView"
ItemsSource="{x:Bind moment}">
moment 是 MainPage.xaml 中 Moment 的一个实例
<GridView.ItemTemplate>
<DataTemplate x:DataType="data:Moment">
<Image Width="75" Height="75">
<Image.Source>
<BitmapImage UriSource="{x:Bind PhotoFilePath}" />
我明白了 严重性代码 描述 项目文件行抑制状态 错误无效的绑定路径“PhotoFilePath”:无法在没有转换器的情况下将类型“System.Collections.ObjectModel.ObservableCollection(System.Uri)”绑定到“System.Uri”
</Image.Source>
</Image>
</DataTemplate>
</GridView.ItemTemplate>
</GridView>
提前致谢
【问题讨论】:
标签: c# wpf xaml data-binding uwp