private static void OnColumnIsReadOnlyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            PropertyColumnDataModel columnModel = (PropertyColumnDataModel)d;

            if (columnModel.Column != null)
            {
                DataGridDesignHelper.SparseSetValue(columnModel.Column.Properties[PlatformTypes.DataGridColumn.IsReadOnlyProperty], e.NewValue);
            }
        }
        private static void OnColumnUseHeaderMetadataChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            PropertyColumnDataModel columnModel = (PropertyColumnDataModel)d;
            bool newValue = (bool)e.NewValue;

            if (newValue)
            {
                // The DataGrid runtime should be updated to re-fetch the Header when this happens at Design time.
                // Currently, the header will be blank if you go from Custom header to use metadata until you reload
                // the DataGrid.  This is because the DataGrid only populates from metadata when the column is added.
                columnModel.ColumnHeader = null;
            }
        }
        private static void OnColumnHeaderPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            PropertyColumnDataModel columnModel = (PropertyColumnDataModel)d;

            if (columnModel.Column != null)
            {
                if (e.NewValue == null)
                {
                    columnModel.Column.Properties[PlatformTypes.DataGridColumn.HeaderProperty].ClearValue();
                }
                else
                {
                    DataGridDesignHelper.SparseSetValue(columnModel.Column.Properties[PlatformTypes.DataGridColumn.HeaderProperty], e.NewValue);
                }
            }
        }
        private static void OnHasColumnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            PropertyColumnDataModel columnModel = (PropertyColumnDataModel)d;
            bool newValue = (bool)e.NewValue;

            if (newValue && columnModel.Column == null)
            {
                columnModel.CreateColumn();
            }
            else if (!newValue && columnModel.Column != null)
            {
                columnModel.ClearColumn();
            }

            // The editor needs to know when the column has changed so it can
            // refresh it's "Select All" checkbox.
            columnModel._parentCollection.PropertyColumnEditor.OnHasColumnChanged();
        }
        private static void OnColumnTypeNameChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            PropertyColumnDataModel columnModel = (PropertyColumnDataModel)d;

            if (!columnModel._isSyncing &&
                columnModel.Column != null &&
                columnModel._columnGenerationInfo != null &&
                columnModel._columnGenerationInfo.PropertyInfo != null &&
                !string.IsNullOrEmpty(columnModel.ColumnTypeName))
            {
                TypeIdentifier columnTypeId = DataGridDesignHelper.GetColumnSystemType(columnModel.ColumnTypeName);
                // Update the column with the model properties.  If someone changed the header,
                // we want to keep this value when they change the type.
                columnModel._restoreColumn = true;
                columnModel.Column         = DataGridDesignHelper.CreateColumnFromColumnType(
                    columnModel._parentCollection.PropertyColumnEditor.EditingContext,
                    columnTypeId,
                    columnModel._columnGenerationInfo);
            }
        }