Say my app has a bunch of DataGrid
s, all with an ItemsSource
that provides objects with an Id
property. Different types of objects for each DataGrid
, but still with an Id
property.
What I’d like to do (but it doesn’t work) is define a global style like this:
<Style TargetType="DataGrid">
<Setter Property="RowHeaderStyle">
<Setter.Value>
<Style TargetType="DataGridRowHeader">
<Setter Property="Content"
Value="{Binding Id}" />
</Style>
</Setter.Value>
</Setter>
</Style>
However, the binding doesn’t seem to work on the individual DataGrid
s, which probably makes sense.
Is this possible in any way? Preferably all in XAML.