Hi I have a DataGrid with some rows, and now when I select one row I want to simultaneously fire up event with this selection, but I am having a problem.
This is my user control resources:
<UserControl.Resources>
<Style x:Key="CollapsedRow" TargetType="{x:Type DataGridRow}">
<EventSetter Event="MouseLeftButtonDown" Handler="OnGroupChange" />
<Setter Property="DetailsVisibility" Value="Collapsed" />
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="DodgerBlue" />
</Trigger>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="SteelBlue"/>
<Setter Property="Foreground" Value="White"/>
</Trigger>
</Style.Triggers>
</Style>
</UserControl.Resources
And my datagrid xaml is simple:
<DataGrid RowStyle="{StaticResource CollapsedRow}" AutoGenerateColumns="false" CanUserAddRows="false" ItemsSource="{Binding Applications}" >
Well as you see I have a event setter for one mouse click that will fire up event and trigger that will change background colour of row if is selected. But it works like first you need to select row that one click and then fire event that is second click. is there a way to do it with one click?