I have an event in my data grid
private void PatientsDataGrid_OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
{
Editor();
}
but whenever I accidentally double clicked the side scroll bar of the data grid, that event always triggers. so what can I put inside an If
statement so that whenever I just accidentally double click the scroll bar, it will skip the Editor();
?
Try to set MouseDoubleClick
event handler on the DataGridRow
level.
<DataGrid>
<DataGrid.Resources>
<Style TargetType="DataGridRow">
<EventSetter Event="MouseDoubleClick"
Handler="PatientsDataGrid_OnMouseDoubleClick"/>
</Style>
</DataGrid.Resources>
</DataGrid>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.