/// <summary>Called when a cell in the column enters editing mode.</summary> /// <param name="editingElement">The element that the column displays for a cell in editing mode.</param> /// <param name="editingEventArgs">Information about the user gesture that is causing a cell to enter editing mode.</param> /// <returns>The unedited value.</returns> // Token: 0x06004787 RID: 18311 RVA: 0x00144D98 File Offset: 0x00142F98 protected override object PrepareCellForEdit(FrameworkElement editingElement, RoutedEventArgs editingEventArgs) { CheckBox checkBox = editingElement as CheckBox; if (checkBox != null) { checkBox.Focus(); bool?isChecked = checkBox.IsChecked; if ((DataGridCheckBoxColumn.IsMouseLeftButtonDown(editingEventArgs) && DataGridCheckBoxColumn.IsMouseOver(checkBox, editingEventArgs)) || DataGridCheckBoxColumn.IsSpaceKeyDown(editingEventArgs)) { checkBox.IsChecked = new bool?(isChecked != true); } return(isChecked); } return(false); }
/// <summary> /// Called when a cell has just switched to edit mode. /// </summary> /// <param name="editingElement">A reference to element returned by GenerateEditingElement.</param> /// <param name="editingEventArgs">The event args of the input event that caused the cell to go into edit mode. May be null.</param> /// <returns>The unedited value of the cell.</returns> protected override object PrepareCellForEdit(FrameworkElement editingElement, RoutedEventArgs editingEventArgs) { CheckBox checkBox = editingElement as CheckBox; if (checkBox != null) { checkBox.Focus(); bool?uneditedValue = checkBox.IsChecked; // If a click or a space key invoked the begin edit, then do an immediate toggle if ((IsMouseLeftButtonDown(editingEventArgs) && IsMouseOver(checkBox, editingEventArgs)) || IsSpaceKeyDown(editingEventArgs)) { checkBox.IsChecked = (uneditedValue != true); } return(uneditedValue); } return((bool?)false); }