コード例 #1
0
 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);
            }
        }
コード例 #3
0
        protected override void OnPreviewGotKeyboardFocus(KeyboardFocusChangedEventArgs e)
        {
            base.OnPreviewGotKeyboardFocus(e);

            if (this.Child != null)
            {
                CellEditor.SetHasError(( DependencyObject )this.Child, false);
            }
        }
コード例 #4
0
ファイル: CellEditor.cs プロジェクト: Drift2020/WPF
        protected override Freezable CreateInstanceCore()
        {
            CellEditor editorClone = new CellEditor();

            foreach (ActivationGesture gesture in this.ActivationGestures)
            {
                editorClone.ActivationGestures.Add(gesture.Clone() as ActivationGesture);
            }

            return(editorClone);
        }
コード例 #5
0
        private static CellEditor TryFreeze(CellEditor editor)
        {
            if ((editor != null) && !editor.IsFrozen)
            {
                DefaultCellEditorSelector.TrySeal(editor.EditTemplate);

                if (editor.CanFreeze)
                {
                    editor.Freeze();
                }
            }

            return(editor);
        }
コード例 #6
0
        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);
        }
コード例 #8
0
    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 );
      }
    } 
コード例 #9
0
 private void SetDefaultCellEditor( CellEditor value )
 {
   this.SetValue( ForeignKeyConfiguration.DefaultCellEditorPropertyKey, value );
 }
コード例 #10
0
    protected override Freezable CreateInstanceCore()
    {
      CellEditor editorClone = new CellEditor();

      foreach( ActivationGesture gesture in this.ActivationGestures )
      {
        editorClone.ActivationGestures.Add( gesture.Clone() as ActivationGesture );
      }

      return editorClone;
    }
コード例 #11
0
 private void SetDefaultCellEditor(CellEditor value)
 {
     this.SetValue(ForeignKeyConfiguration.DefaultCellEditorPropertyKey, value);
 }