我正在使用几个Grid
s 来格式化多个GridViewColumn.CellTemplate
s:
<ListView SharedSizeScope="true">
<ListView.View>
<GridView>
<GridViewColumn>
<GridViewColumn.CellTemplate>
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition SharedSizeGroup="foo" />
<!-- ... -->
我试图将RowDefinition
s (所有列都相同)提取到 a 中Style
:
<Style TargetType="{x:Type Grid}">
<Setter Property="RowDefinitions">
<Setter.Value>
<RowDefinition SharedSizeGroup="foo" />
<!-- ... -->
但是编译器抱怨:
错误:无法设置属性设置器“RowDefinitions”,因为它没有可访问的设置访问器。
这很明显,但不是很有帮助。
我如何避免多次指定行定义(另请参阅不要重复自己),而不是编写自定义派生的Grid
?