我用了两个
Grid
s格式化多个
GridViewColumn.CellTemplate
S:
<ListView SharedSizeScope="true">
<ListView.View>
<GridView>
<GridViewColumn>
<GridViewColumn.CellTemplate>
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition SharedSizeGroup="foo" />
我试图提取
RowDefinition
s(所有列相同)转换为
Style
:
<Style TargetType="{x:Type Grid}">
<Setter Property="RowDefinitions">
<Setter.Value>
<RowDefinition SharedSizeGroup="foo" />
但是编译器抱怨:
错误:属性setter
无法设置“rowdefinitions”,因为
它没有可访问的集
访问器。
这是显而易见的,但不是很有帮助。
如何避免多次指定行定义(另请参见
Don't Repeat Yourself
)缺少对自定义派生的
网格
?