internal bool CommitEdit(DataGridEditingUnit dataGridEditingUnit, bool exitEditingMode)
 {
     return(DataGrid.CommitEdit(dataGridEditingUnit, exitEditingMode));
 }
Example #2
0
            // set the value (used when setting value via automation)
            public void SetValue(DataGrid dataGrid, object value, bool clipboard)
            {
                if (_column.ClipboardContentBinding == null)
                    return;

                _inSetValue = true;

                // add a two-way binding (it joins the BindingGroup)
                DependencyProperty dp = clipboard ? CellClipboardProperty : CellContentProperty;
                BindingBase binding = _column.ClipboardContentBinding.Clone(BindingMode.TwoWay);
                BindingOperations.SetBinding(_cell, dp, binding);

                // set the new value
                _cell.SetValue(dp, value);

                // do a cell-level commit - this will validate the new value
                dataGrid.CommitEdit();

                // whether valid or not, remove the binding.  The binding group will
                // remember the proposed value
                BindingOperations.ClearBinding(_cell, dp);

                _inSetValue = false;
            }