DataGrid의 DataGrid 행에서 두 번 클릭 된 라우트 된 이벤트를 처리합니다. 코드 숨김
<tk:DataGrid>
<tk:DataGrid.Resources>
<Style TargetType="{x:Type tk:DataGridRow}">
<EventSetter Event="MouseDoubleClick"
Handler="DataGridRow_MouseDoubleClick"/>
</Style>
</tk:DataGrid.Resources>
<tk:DataGrid.ItemsSource>
<x:Array Type="{x:Type TextBlock}">
<TextBlock Text="1" Tag="1.1"/>
<TextBlock Text="2" Tag="1.2"/>
<TextBlock Text="3" Tag="1.3"/>
<TextBlock Text="4" Tag="1.4"/>
</x:Array>
</tk:DataGrid.ItemsSource>
<tk:DataGrid.Columns>
<tk:DataGridTextColumn Header="Text" Binding="{Binding Text}"/>
<tk:DataGridTextColumn Header="Tag" Binding="{Binding Tag}"/>
</tk:DataGrid.Columns>
</tk:DataGrid>
private void DataGridRow_MouseDoubleClick(
object sender, MouseButtonEventArgs e)
{
var dgRow = sender as Microsoft.Windows.Controls.DataGridRow;
var cellContentElement = e.OriginalSource as UIElement;
}
보너스 cellContentElement
이중 행에 클릭 된 셀의 내용 요소이다 예 ... DataGridTextColumn
의 경우 셀에 TextBlock
이됩니다.