是否有一种方法可以绑定到XamDataGrid DataSource中的集合列?
我要做的是在一个网格字段中显示特定列集合的所有项。(使用适当的模板)。
希望这对你们所有人都有意义。如果你需要我澄清一些事情,请告诉我。
发布于 2010-06-14 23:53:29
我终于找到了答案。我只是使用包装器类来托管集合,并将列绑定到包装器类属性,而不是集合属性。
之后,制作合适的模板就很容易了。
下面是一个示例:
<Style x:Key="ValidationsStyle" TargetType="{x:Type igDP:CellValuePresenter}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type igDP:CellValuePresenter}">
<ContentControl DataContext="{TemplateBinding Value}">
<ItemsControl ItemsSource="{Binding Validations}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding ValidationName}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ContentControl>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>https://stackoverflow.com/questions/3038402
复制相似问题