我正在使用几个Grid
来格式化多个GridViewColumn.CellTemplate
:
<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" />
<!-- ... -->
但是编译器抱怨道:
错误:属性设置器 无法设置'RowDefinitions',因为 它没有可访问的集合 存取器。
这有点明显,但不是很有用。
我怎样才能避免多次指定行定义(另请参阅Don't Repeat Yourself),而不是编写Grid
的自定义派生?