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 static CellEditor TryFreeze(CellEditor editor)
        {
            if ((editor != null) && !editor.IsFrozen)
            {
                DefaultCellEditorSelector.TrySeal(editor.EditTemplate);

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

            return(editor);
        }
    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 );
      }
    }