Skip to main content

Subscribing to the Events of an Element

The following example demonstrates how to subscribe the MouseEnter and MouseLeave events of each DataRow using EventTriggers in an implicit style. The MouseEnter and MouseLeave event handlers are provided below.

<Grid xmlns:xcdg="http://schemas.xceed.com/wpf/xaml/datagrid">
<Grid.Resources>
<xcdg:DataGridCollectionViewSource x:Key="cvs_orders"
Source="{Binding Source={x:Static Application.Current},
Path=Orders}"/>
<Style TargetType="{x:Type xcdg:DataRow}">
<EventSetter Event="MouseEnter"
Handler="DataRowMouseEnter"/>
<EventSetter Event="MouseLeave"
Handler="DataRowMouseLeave"/>
</Style>
</Grid.Resources>

<xcdg:DataGridControl x:Name="OrdersGrid"
ItemsSource="{Binding Source={StaticResource cvs_orders}}"
View="TableView.LunaNormalColorTheme"/>
</Grid>