这种行为背后的原因是什么?即使尚未进行编辑,滚动数据也会导致定义为
的验证规则
<DataGrid.RowValidationRules>
<local:RowValidationChecker ValidationStep="CommittedValue" ValidatesOnTargetUpdated="True"/>
</DataGrid.RowValidationRules>
开火。关于如何禁用此行为的任何想法,或者可能检查是否已发出编辑,以便即使验证射击也可以放在有条件的分支中?
谢谢!
您是否有一个由PreviewMouseleftButtondown击中的事件? 如果是这样,单击卷轴可以发射。
您可以过滤此行为:
private void DataGrid_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
DependencyObject src = VisualTreeHelper.GetParent((DependencyObject)e.OriginalSource);
if (src.GetType() == typeof(ContentPresenter))
{
--- your event code ----
}
}