tags:

views:

3294

answers:

1

Hi!

I'm using a couple of Grids to format multiple GridViewColumn.CellTemplates:

<ListView SharedSizeScope="true">
  <ListView.View>
    <GridView>
      <GridViewColumn>
        <GridViewColumn.CellTemplate>
          <DataTemplate>
            <Grid>
              <Grid.RowDefinitions>
                <RowDefinition SharedSizeGroup="foo" />
                <!-- ... -->

I tried to extract the RowDefinitions (which are the same for all columns) into a Style:

<Style TargetType="{x:Type Grid}">
  <Setter Property="RowDefinitions">
    <Setter.Value>
      <RowDefinition SharedSizeGroup="foo" />
      <!-- ... -->

But the compiler complains:

Error: The Property Setter 'RowDefinitions' cannot be set because it does not have an accessible set accessor.

Which is kind of obvious, but not very helpful.

How could I avoid specifying the row definitions multiple times (see also Don't Repeat Yourself) short of coding up a custom derivation of the Grid?

+2  A: 

Grid doesn't support control templates (info taken from here and, indirectly, from here).

Tomalak