重写WPF GridViewRowPresenter的单元格模板
我正在生成一个自定义控件,该控件使用的方式与绑定到控件上重写WPF GridViewRowPresenter的单元格模板,wpf,celltemplate,Wpf,Celltemplate,我正在生成一个自定义控件,该控件使用的方式与绑定到控件上视图属性的列集合的方式类似,该属性类型为: 这很好,但是我的控件(MyControlType)需要能够“覆盖”网格中列的单元格模板,以便它们包含一些附加内容 如何在对控件用户需要编写的语法进行最小更改的情况下实现这一点 <GridViewRowPresenter Content="{Binding Content}" Columns="{Binding Path=View.Columns, RelativeSource={R
视图
属性的列
集合的方式类似,该属性类型为:
这很好,但是我的控件(MyControlType)需要能够“覆盖”网格中列的单元格模板,以便它们包含一些附加内容
如何在对控件用户需要编写的语法进行最小更改的情况下实现这一点
<GridViewRowPresenter Content="{Binding Content}"
Columns="{Binding Path=View.Columns, RelativeSource={RelativeSource AncestorType={x:Type local:MyControlType}}}" />
<MyControlType><MyControlType.View><GridView>
<GridViewColumn Header="Name" DisplayMemberBinding="{Binding Name}" />
<GridViewColumn Header="Address" CellTemplate="{StaticResource MyCellTemplate}" />
</GridView></MyControlType.View></MyControlType>