示例#1
0
 public override void OnMouseUp(GridCellMouseEventArgs args, sw.DependencyObject hitTestResult, swc.DataGridCell cell)
 {
     if (cell?.IsEditing == false && !Control.IsReadOnly && !hitTestResult.GetVisualParents().TakeWhile(r => !(r is swc.DataGridCell)).OfType <swc.TextBlock>().Any())
     {
         // prevent default behaviour of editing unless we click on the text
         args.Handled = true;
     }
     base.OnMouseUp(args, hitTestResult, cell);
 }
示例#2
0
        public override void OnMouseDown(GridCellMouseEventArgs args, sw.DependencyObject hitTestResult, swc.DataGridCell cell)
        {
            if (cell?.IsEditing == true && !hitTestResult.GetVisualParents().TakeWhile(r => !(r is swc.DataGridCell)).OfType <swc.TextBox>().Any())
            {
                // commit editing when clicking on anything other than the text box
                ContainerHandler?.Grid.CommitEdit();
                args.Handled = true;
            }

            base.OnMouseDown(args, hitTestResult, cell);
        }