Пример #1
0
 // Token: 0x060048B7 RID: 18615 RVA: 0x0014A3E4 File Offset: 0x001485E4
 private void ApplyColumnProperties(ComboBox comboBox)
 {
     DataGridComboBoxColumn.ApplyBinding(this.SelectedItemBinding, comboBox, Selector.SelectedItemProperty);
     DataGridComboBoxColumn.ApplyBinding(this.SelectedValueBinding, comboBox, Selector.SelectedValueProperty);
     DataGridComboBoxColumn.ApplyBinding(this.TextBinding, comboBox, ComboBox.TextProperty);
     DataGridHelper.SyncColumnProperty(this, comboBox, Selector.SelectedValuePathProperty, DataGridComboBoxColumn.SelectedValuePathProperty);
     DataGridHelper.SyncColumnProperty(this, comboBox, ItemsControl.DisplayMemberPathProperty, DataGridComboBoxColumn.DisplayMemberPathProperty);
     DataGridHelper.SyncColumnProperty(this, comboBox, ItemsControl.ItemsSourceProperty, DataGridComboBoxColumn.ItemsSourceProperty);
 }
Пример #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);
        }