3

I'm producing a custom control that uses a GridViewRowPresenter in a similar way to the way that the ListView does - binding to the Columns collection of a View property on my control which is of type ViewBase:

<GridViewRowPresenter Content="{Binding Content}" 
    Columns="{Binding Path=View.Columns, RelativeSource={RelativeSource AncestorType={x:Type local:MyControlType}}}" />

This means that users of the control are able to specify the columns using the familiar GridView style syntax, for example:

<MyControlType><MyControlType.View><GridView>
    <GridViewColumn Header="Name" DisplayMemberBinding="{Binding Name}" />
    <GridViewColumn Header="Address" CellTemplate="{StaticResource MyCellTemplate}" />
</GridView></MyControlType.View></MyControlType>

This works fine, however my control (the MyControlType) need to be able to "override" the cell template for the columns in my grid so that they includes some additional content.

How can I do this with minimal change to the syntax users of the control need to write?

Justin
  • 84,773
  • 49
  • 224
  • 367

0 Answers0