WPF DataGridRow Template - how to achieve Selected event
- by user1809972
I would like to override the DataGridRow template depending on the datatype of object bound to the grid. If the type is label, it just shows a Label. Otehrwise, it shows the cells. Follwing is the xaml.
<DataTrigger Binding="{Binding Path=IsLabel, UpdateSourceTrigger=PropertyChanged}" Value="True">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DataGridRow}">
<Grid>
<Label HorizontalAlignment="Center" Padding="3,3,3,3" FontWeight="Bold" Content="{Binding Id}"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</DataTrigger>
The grid looks ok. But, when the Label is clicked, it doesnt raise the Selection changed event for the DataGridRow. How do I achieve this behaviour? This label should just behave as any other DataGridRow(with the default template).
Thanks