コード例 #1
0
        protected internal override void RefreshCellContent(FrameworkElement element, string propertyName)
        {
            DataGridCell cell = element as DataGridCell;

            if (cell != null)
            {
                bool isCellEditing = cell.IsEditing;
                if ((string.Compare(propertyName, "ElementStyle", StringComparison.Ordinal) == 0 && !isCellEditing) ||
                    (string.Compare(propertyName, "EditingElementStyle", StringComparison.Ordinal) == 0 && isCellEditing))
                {
                    cell.BuildVisualTree();
                }
                else
                {
                    ComboBox comboBox = cell.Content as ComboBox;
                    switch (propertyName)
                    {
                    case "SelectedItemBinding":
                        ApplyBinding(SelectedItemBinding, comboBox, ComboBox.SelectedItemProperty);
                        break;

                    case "SelectedValueBinding":
                        ApplyBinding(SelectedValueBinding, comboBox, ComboBox.SelectedValueProperty);
                        break;

                    case "TextBinding":
                        ApplyBinding(TextBinding, comboBox, ComboBox.TextProperty);
                        break;

                    case "SelectedValuePath":
                        DataGridHelper.SyncColumnProperty(this, comboBox, ComboBox.SelectedValuePathProperty, SelectedValuePathProperty);
                        break;

                    case "DisplayMemberPath":
                        DataGridHelper.SyncColumnProperty(this, comboBox, ComboBox.DisplayMemberPathProperty, DisplayMemberPathProperty);
                        break;

                    case "ItemsSource":
                        DataGridHelper.SyncColumnProperty(this, comboBox, ComboBox.ItemsSourceProperty, ItemsSourceProperty);
                        break;

                    default:
                        base.RefreshCellContent(element, propertyName);
                        break;
                    }
                }
            }
            else
            {
                base.RefreshCellContent(element, propertyName);
            }
        }
コード例 #2
0
        /// <summary>Refreshes the contents of a cell in the column in response to a binding change.</summary>
        /// <param name="element">The cell to update.</param>
        /// <param name="propertyName">The name of the column property that has changed.</param>
        // Token: 0x060048B3 RID: 18611 RVA: 0x0014A240 File Offset: 0x00148440
        protected internal override void RefreshCellContent(FrameworkElement element, string propertyName)
        {
            DataGridCell dataGridCell = element as DataGridCell;

            if (dataGridCell == null)
            {
                base.RefreshCellContent(element, propertyName);
                return;
            }
            bool isEditing = dataGridCell.IsEditing;

            if ((string.Compare(propertyName, "ElementStyle", StringComparison.Ordinal) == 0 && !isEditing) || (string.Compare(propertyName, "EditingElementStyle", StringComparison.Ordinal) == 0 && isEditing))
            {
                dataGridCell.BuildVisualTree();
                return;
            }
            ComboBox comboBox = dataGridCell.Content as ComboBox;

            if (propertyName == "SelectedItemBinding")
            {
                DataGridComboBoxColumn.ApplyBinding(this.SelectedItemBinding, comboBox, Selector.SelectedItemProperty);
                return;
            }
            if (propertyName == "SelectedValueBinding")
            {
                DataGridComboBoxColumn.ApplyBinding(this.SelectedValueBinding, comboBox, Selector.SelectedValueProperty);
                return;
            }
            if (propertyName == "TextBinding")
            {
                DataGridComboBoxColumn.ApplyBinding(this.TextBinding, comboBox, ComboBox.TextProperty);
                return;
            }
            if (propertyName == "SelectedValuePath")
            {
                DataGridHelper.SyncColumnProperty(this, comboBox, Selector.SelectedValuePathProperty, DataGridComboBoxColumn.SelectedValuePathProperty);
                return;
            }
            if (propertyName == "DisplayMemberPath")
            {
                DataGridHelper.SyncColumnProperty(this, comboBox, ItemsControl.DisplayMemberPathProperty, DataGridComboBoxColumn.DisplayMemberPathProperty);
                return;
            }
            if (!(propertyName == "ItemsSource"))
            {
                base.RefreshCellContent(element, propertyName);
                return;
            }
            DataGridHelper.SyncColumnProperty(this, comboBox, ItemsControl.ItemsSourceProperty, DataGridComboBoxColumn.ItemsSourceProperty);
        }
コード例 #3
0
        /// <summary>Refreshes the contents of a cell in the column in response to a template property value change.</summary>
        /// <param name="element">The cell to update.</param>
        /// <param name="propertyName">The name of the column property that has changed.</param>
        // Token: 0x060049AE RID: 18862 RVA: 0x0014D334 File Offset: 0x0014B534
        protected internal override void RefreshCellContent(FrameworkElement element, string propertyName)
        {
            DataGridCell dataGridCell = element as DataGridCell;

            if (dataGridCell != null)
            {
                bool isEditing = dataGridCell.IsEditing;
                if ((!isEditing && (string.Compare(propertyName, "CellTemplate", StringComparison.Ordinal) == 0 || string.Compare(propertyName, "CellTemplateSelector", StringComparison.Ordinal) == 0)) || (isEditing && (string.Compare(propertyName, "CellEditingTemplate", StringComparison.Ordinal) == 0 || string.Compare(propertyName, "CellEditingTemplateSelector", StringComparison.Ordinal) == 0)))
                {
                    dataGridCell.BuildVisualTree();
                    return;
                }
            }
            base.RefreshCellContent(element, propertyName);
        }
コード例 #4
0
        /// <summary>Rebuilds the contents of a cell in the column in response to a binding change.</summary>
        /// <param name="element">The cell to update.</param>
        /// <param name="propertyName">The name of the column property that has changed.</param>
        // Token: 0x060046DB RID: 18139 RVA: 0x00141558 File Offset: 0x0013F758
        protected internal override void RefreshCellContent(FrameworkElement element, string propertyName)
        {
            DataGridCell dataGridCell = element as DataGridCell;

            if (dataGridCell != null)
            {
                bool isEditing = dataGridCell.IsEditing;
                if (string.Compare(propertyName, "Binding", StringComparison.Ordinal) == 0 || (string.Compare(propertyName, "ElementStyle", StringComparison.Ordinal) == 0 && !isEditing) || (string.Compare(propertyName, "EditingElementStyle", StringComparison.Ordinal) == 0 && isEditing))
                {
                    dataGridCell.BuildVisualTree();
                    return;
                }
            }
            base.RefreshCellContent(element, propertyName);
        }