private void OnInputValidationError(object sender, InputValidationErrorEventArgs e) { if (this.Child != null) { CellEditor.SetHasError(( DependencyObject )this.Child, true); } }
private static void ThreadSafeTryFreezeEditor(CellEditor cellEditor) { if (cellEditor == null) { throw new ArgumentNullException("cellEditor"); } if (DefaultCellEditorSelector.Instance.CheckAccess()) { if (cellEditor.IsFrozen) { return; } if ((cellEditor.EditTemplate != null) && (!cellEditor.EditTemplate.IsSealed)) { cellEditor.EditTemplate.Seal(); } System.Diagnostics.Debug.Assert(cellEditor.CanFreeze); if (cellEditor.CanFreeze) { cellEditor.Freeze(); } } else { DefaultCellEditorSelector.Instance.Dispatcher.Invoke( new Action <CellEditor>(DefaultCellEditorSelector.ThreadSafeTryFreezeEditor), cellEditor); } }
protected override void OnPreviewGotKeyboardFocus(KeyboardFocusChangedEventArgs e) { base.OnPreviewGotKeyboardFocus(e); if (this.Child != null) { CellEditor.SetHasError(( DependencyObject )this.Child, false); } }
protected override Freezable CreateInstanceCore() { CellEditor editorClone = new CellEditor(); foreach (ActivationGesture gesture in this.ActivationGestures) { editorClone.ActivationGestures.Add(gesture.Clone() as ActivationGesture); } return(editorClone); }
private static CellEditor TryFreeze(CellEditor editor) { if ((editor != null) && !editor.IsFrozen) { DefaultCellEditorSelector.TrySeal(editor.EditTemplate); if (editor.CanFreeze) { editor.Freeze(); } } return(editor); }
private static bool TryGetCellEditor(object key, out CellEditor value) { var resource = default(object); if (!DefaultCellEditorSelector.TryGetResource(key, out resource)) { value = default(CellEditor); return(false); } else { value = DefaultCellEditorSelector.TryFreeze(resource as CellEditor); return(value != null); } }
public static CellEditor SelectCellEditor(Type dataType) { CellEditor cellEditor = null; if (dataType != null) { if ((dataType.IsGenericType) && (dataType.GetGenericTypeDefinition() == typeof(Nullable <>))) { dataType = Nullable.GetUnderlyingType(dataType); } cellEditor = DefaultCellEditorSelector.ThreadSafeTryFindResource(dataType.FullName) as CellEditor; if (cellEditor != null) { DefaultCellEditorSelector.ThreadSafeTryFreezeEditor(cellEditor); } } return(cellEditor); }
private static void ThreadSafeTryFreezeEditor( CellEditor cellEditor ) { if( cellEditor == null ) throw new ArgumentNullException( "cellEditor" ); if( DefaultCellEditorSelector.Instance.CheckAccess() ) { if( cellEditor.IsFrozen ) return; if( ( cellEditor.EditTemplate != null ) && ( !cellEditor.EditTemplate.IsSealed ) ) cellEditor.EditTemplate.Seal(); System.Diagnostics.Debug.Assert( cellEditor.CanFreeze ); if( cellEditor.CanFreeze ) cellEditor.Freeze(); } else { DefaultCellEditorSelector.Instance.Dispatcher.Invoke( new Action<CellEditor>( DefaultCellEditorSelector.ThreadSafeTryFreezeEditor ), cellEditor ); } }
private void SetDefaultCellEditor( CellEditor value ) { this.SetValue( ForeignKeyConfiguration.DefaultCellEditorPropertyKey, value ); }
protected override Freezable CreateInstanceCore() { CellEditor editorClone = new CellEditor(); foreach( ActivationGesture gesture in this.ActivationGestures ) { editorClone.ActivationGestures.Add( gesture.Clone() as ActivationGesture ); } return editorClone; }
private void SetDefaultCellEditor(CellEditor value) { this.SetValue(ForeignKeyConfiguration.DefaultCellEditorPropertyKey, value); }