Hi,
I would like to change the backGround of the row when the mouse is over it using MouseEnter and Mouse Leave events, but it does not seems to work :
<
Style TargetType="{x:Type xcdg:DataRow}">
<EventSetter Event="MouseEnter"
Handler="DataRowMouseEnter"/>
<EventSetter Event="MouseLeave"
Handler="DataRowMouseLeave"/>
</Style>
C# code:
void
DataRowMouseEnter(object sender, MouseEventArgs e)
{
Xceed.Wpf.DataGrid.
DataRow dataRow = sender as Xceed.Wpf.DataGrid.DataRow;
lastBrush = dataRow.Background;
dataRow.Background =
Brushes.Orange;
}
void DataRowMouseLeave(object sender, MouseEventArgs e)
{
Xceed.Wpf.DataGrid.
DataRow dataRow = sender as Xceed.Wpf.DataGrid.DataRow;
dataRow.Background = lastBrush;
}
I would also like to change the default row color when the when the row is selected and when the selected row looses the focus by using the code below, but is does not work :
<Grid.Resources>
<Style TargetType="{x:Type xcdg:DataRow}">
<Setter Property="InactiveSelectionBackground" Value="Orange" />
<Setter Property="SelectionBackground" Value="Red" />
</Style>
</Grid.Resources>
<xcdg:DataGridControl Grid.Row="1" Margin="66,40,66,62" Name="dataGridControl1">
<xcdg:DataGridControl.Columns>
<xcdg:Column FieldName="ColumnA" Title="ColumnA" />
<xcdg:Column FieldName="ColumnB" Title="ColumnB" />
</xcdg:DataGridControl.Columns>
<xcdg:DataGridControl.View>
<xcdg:TableView HorizontalGridLineThickness="1" VerticalGridLineThickness="1">
<xcdg:TableView.Theme>
<xcdg:AeroNormalColorTheme />
</xcdg:TableView.Theme>
<xcdg:TableView.Footers>
<DataTemplate>
<xcdg:InsertionRow/>
</DataTemplate>
</xcdg:TableView.Footers>
</xcdg:TableView>
</xcdg:DataGridControl.View>
</xcdg:DataGridControl>
Could you please help me to solve the issues above ? My code seems to have no effect in the application.
Thanks
Rafael