示例#1
0
 // *******************************************************************
 // common code for Column Auto-generation
 // i.e. creation of combo columns (we show the same data in all the grids)
 // *******************************************************************
 public static void HandleColumnAutoGeneration(DataGridAutoGeneratingColumnEventArgs e)
 {
     if (new string[] { "Color", "ID", "ProductSubcategoryID", "Description", "GifImage" }.Contains(e.Property.Name))
     {
         e.Cancel = true;
         return;
     }
     if (e.Property.Name == "ProductModelID")
     {
         var comboCol = new DataGridComboBoxColumn(e.Property);
         var models = Data.GetModels().OrderBy(m => m.Name).ToList();
         models.Insert(0, new Model { Name = "Not specified", ProductModelID = 0 });
         comboCol.ItemsSource = models;
         comboCol.DisplayMemberPath = "Name";
         comboCol.SelectedValuePath = "ProductModelID";
         comboCol.Header = "Model";
         e.Column = comboCol;
     }
     if (e.Property.Name == "ImageUrl")
     {
         //CLR40
         string imgPath = "/" + new AssemblyName(Assembly.GetExecutingAssembly().FullName).Name + ";component/Resources/";
         var imageColumn = new DataGridImageColumn(e.Property);
         imageColumn.SortMemberPath = "ImageUrl";
         imageColumn.Binding.Converter = new ImageSourceConverter();
         imageColumn.Binding.ConverterParameter = imgPath;
         imageColumn.Width = new DataGridLength(85);
         imageColumn.GroupContentConverter = new ImageSourceConverter();
         imageColumn.Format = imgPath;
         imageColumn.Header = "Image";
         e.Column = imageColumn;
     }
     if (e.Property.Name == "ExpirationDate")
     {
         //(e.Column as DataGridDateColumn).SelectedDateFormat = C1DatePickerFormat.Custom;
         e.Column.GroupConverter = new OutlookDateGroupConverter();
         e.Column.GroupContentConverter = new OutlookDateGroupNameConverter();
         e.Column.Header = "Expiration Date";
     }
     if (e.Property.Name == "Name")
     {
         IValueConverter converter = new AlphabeticTextGroupConverter();
         e.Column.GroupConverter = converter;
     }
     if (e.Property.Name == "ProductNumber")
     {
         IValueConverter converter = new ProductGroupConverter();
         e.Column.GroupConverter = converter;
         e.Column.GroupContentConverter = converter;
         e.Column.Header = "Product Number";
         (e.Column as DataGridTextColumn).MaxLength = 10;
     }
     if (e.Property.Name == "StandardCost" && e.Column is C1.WPF.DataGrid.DataGridBoundColumn)
     {
         e.Column.GroupConverter = new NumberRangeGroupConverter();
         e.Column.GroupContentConverter = new NumberRangeGroupNameConverter();
         e.Column.Header = "Standard Cost";
         ((C1.WPF.DataGrid.DataGridBoundColumn)e.Column).Format = "C";
     }
 }
示例#2
0
        public C3Window(CCRecordSet ccRecordSet, string recordSetFileName, C3Configuration config)
            : this()
        {
            this.ccRecordSet          = ccRecordSet;
            this.recordSetFileName    = recordSetFileName;
            this.config               = config;
            this.editDateTimeRange    = Selectors.timeFilters[Consts.TIMEEXPR_LASTMONTH];
            this.summaryDateTimeRange = Selectors.timeFilters[Consts.TIMEEXPR_LASTMONTH];

            this.requiredHeaderNames = new HashSet <string>(this.ccRecordSet.RequiredHeaderNames);
            currentDataTable         = ccRecordSet.ToDataTable();

            UpdateEditDataGrid();

            foreach (var header in this.ccRecordSet.RequiredHeaderNames)
            {
                var col = new DataGridTextColumn
                {
                    Header  = header,
                    Binding = new Binding(header)
                    {
                        StringFormat = columnFormats[header]
                    },
                    IsReadOnly = true
                };
                EditTabDatagrid.Columns.Add(col);
            }
            foreach (var header in config.columns)
            {
                var col = new DataGridComboBoxColumn
                {
                    Header               = header.columnName,
                    ItemsSource          = header.validValues,
                    SelectedValueBinding = new Binding(header.columnName)
                };
                EditTabDatagrid.Columns.Add(col);
            }

            EditTimeFilterComboBox.ItemsSource  = Selectors.timeFilters.Keys;
            EditTimeFilterComboBox.SelectedItem = Selectors.timeFilters.Keys.FirstOrDefault();

            SummaryTimeFilterComboBox.ItemsSource  = Selectors.timeFilters.Keys;
            SummaryTimeFilterComboBox.SelectedItem = Selectors.timeFilters.Keys.FirstOrDefault();
            SummaryAggregateComboBox.ItemsSource   = this.ccRecordSet.PredictedHeaderNames;
            SummaryAggregateComboBox.SelectedItem  = this.ccRecordSet.PredictedHeaderNames.FirstOrDefault();

            ReportGroupByComboBox.ItemsSource      = this.ccRecordSet.PredictedHeaderNames;
            ReportGroupByComboBox.SelectedIndex    = 0;
            ReportPeriodComboBox.ItemsSource       = Selectors.periodSpecifiers.Keys;
            ReportPeriodComboBox.SelectedItem      = Consts.PERIOD_SPECIFIER_MONTH;
            ReportAggregationComboBox.ItemsSource  = Selectors.aggreations.Keys;
            ReportAggregationComboBox.SelectedItem = Consts.AGGREGATION_SUM;
        }
示例#3
0
        private void setComboBindingAndHanldeUnsetValue(object sender, RequestBringIntoViewEventArgs e)
        {
            ComboBox combo = sender as ComboBox;
            DataGridComboBoxColumn column = AssignedDataGridColumn as DataGridComboBoxColumn;

            if (column.ItemsSource == null)
            {
                if (combo.ItemsSource != null)
                {
                    IList list = combo.ItemsSource.Cast <object>().ToList();

                    if (list.Count > 0 && list[0] != DependencyProperty.UnsetValue)
                    {
                        combo.RequestBringIntoView -=
                            new RequestBringIntoViewEventHandler(setComboBindingAndHanldeUnsetValue);

                        list.Insert(0, DependencyProperty.UnsetValue);

                        combo.DisplayMemberPath = column.DisplayMemberPath;
                        combo.SelectedValuePath = column.SelectedValuePath;

                        combo.ItemsSource = list;
                    }
                }
            }
            else
            {
                combo.RequestBringIntoView -=
                    new RequestBringIntoViewEventHandler(setComboBindingAndHanldeUnsetValue);

                IList comboList  = null;
                IList columnList = null;

                if (combo.ItemsSource != null)
                {
                    comboList = combo.ItemsSource.Cast <object>().ToList();
                }

                columnList = column.ItemsSource.Cast <object>().ToList();

                if (comboList == null ||
                    (columnList.Count > 0 && columnList.Count + 1 != comboList.Count))
                {
                    columnList = column.ItemsSource.Cast <object>().ToList();
                    columnList.Insert(0, DependencyProperty.UnsetValue);

                    combo.ItemsSource = columnList;
                }

                combo.RequestBringIntoView +=
                    new RequestBringIntoViewEventHandler(setComboBindingAndHanldeUnsetValue);
            }
        }
示例#4
0
        private void FillGrid()
        {
            EditProp.configChanged  = false;
            EditProp.configIterator = 0;
            DataGridCheckBoxColumn checkVersion;
            DataGridComboBoxColumn cmbBoxCol;
            DataGridTextColumn     textColumn;

            string[] colNames = new string[] { "Конфигурация", "Обозначение", "Наименование", "Масса" };
            foreach (var item in colNames)
            {
                textColumn         = new DataGridTextColumn();
                textColumn.Header  = item;
                textColumn.Binding = new Binding(item);
                if (item == "Конфигурация")
                {
                    textColumn.IsReadOnly = true;
                }

                dataGrid.Columns.Add(textColumn);
            }

            // COMBOBOX
            cmbBoxCol                     = new DataGridComboBoxColumn();
            cmbBoxCol.Header              = "Раздел";
            cmbBoxCol.ItemsSource         = EditProp.razdel;
            cmbBoxCol.SelectedItemBinding = new Binding("Раздел");
            dataGrid.Columns.Add(cmbBoxCol);


            //CHECHBOX
            checkVersion         = new DataGridCheckBoxColumn();
            checkVersion.Header  = "Исполнение";
            checkVersion.Binding = new Binding("Исполнение");
            dataGrid.Columns.Add(checkVersion);


            /*delegatik = new My(MakeChangesToGrid);
             *
             * EventSetter setter = new EventSetter();
             *
             * setter.Event = TapEvent;
             *
             * setter.Handler = delegatik;
             * Style style = checkVersion.CellStyle;
             * style.Setters.Add(setter);
             */


            dv = WorkWithCommonConfFixer.PropertiesForEachConf().AsDataView();
            dataGrid.ItemsSource = dv;
        }
示例#5
0
        public override void Perform()
        {
            PropertyInfo[] props = typeof(ConstrainedDataGridItem).GetProperties();
            for (int i = 0; i < props.Length; i++)
            {
                DataGridColumn col = null;
                if (props[i].PropertyType == typeof(Boolean))
                {
                    col = new DataGridCheckBoxColumn();
                }
                if (props[i].PropertyType == typeof(Enumerations))
                {
                    col = new DataGridComboBoxColumn();
                    Array array = Enum.GetNames(typeof(Enumerations));
                    ((DataGridComboBoxColumn)col).ItemsSource = array;
                }
                if (props[i].PropertyType == typeof(Uri))
                {
                    col = new DataGridHyperlinkColumn();
                    ((DataGridHyperlinkColumn)col).ContentBinding = new Binding(props[i].Name);
                }
                else
                {
                    col = new DataGridTextColumn();
                }
                DataGrid.Columns.Add(col);
            }
            Window.Content = DataGrid;
            DataGrid.Measure(Window.RenderSize);

            if (ItemList.Count != 0)
            {
                for (int i = 0; i < ItemsCount; i++)
                {
                    AddItem(DataGrid, Add, i, ItemList[(int)(Rate * ItemList.Count)]);
                }
            }

            if (DataGrid.Items.Count != 0)
            {
                if (RemoveByIndex)
                {
                    DataGrid.Items.RemoveAt((int)(Rate * DataGrid.Items.Count));
                }
                else
                {
                    DataGrid.Items.Remove(DataGrid.Items[(int)(Rate * DataGrid.Items.Count)]);
                }
            }

            DataGrid.UpdateLayout();
        }
示例#6
0
        private void AddColumnForVariableAtIndex(int i, CustomVariable variable)
        {
            var viewModelColumn = ViewModel.Columns[i];


            DataGridColumn column;

            TypeConverter converter = variable.GetTypeConverter(ViewModel.Element);

            if (converter != null)
            {
                if (converter is TypeConverterWithNone)
                {
                    ((TypeConverterWithNone)converter).IncludeNoneOption = false;
                }

                var comboBoxColumn = new DataGridComboBoxColumn();
                comboBoxColumn.ItemsSource         = converter.GetStandardValues();
                comboBoxColumn.SelectedItemBinding = new Binding($"Variables[{i}]")
                {
                    UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged
                };
                column = comboBoxColumn;
            }
            else if (variable.Type == "bool")
            {
                // I used checkbox but null vs false is not clear (indetermine state), and
                // I'm not sure users want that, or if they even can. Dropdown is clearer.
                var comboBoxColumn = new DataGridComboBoxColumn();
                // capitalize true/false so they ToString properly
                comboBoxColumn.ItemsSource         = new object[] { "", true, false };
                comboBoxColumn.SelectedItemBinding = new Binding($"Variables[{i}]")
                {
                    UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged
                };
                column = comboBoxColumn;
            }
            else
            {
                var textColumn = new DataGridTextColumn();
                textColumn.Binding = new Binding($"Variables[{i}]")
                {
                    UpdateSourceTrigger = UpdateSourceTrigger.LostFocus
                };
                column = textColumn;
            }



            column.Header = viewModelColumn;
            DataGridInstance.Columns.Add(column);
        }
示例#7
0
        private void ListaAjuste()
        {
            ObservableCollection <Ajuste> ListadoAjuste = new ObservableCollection <Ajuste>();

            ListadoAjuste.Add(new Ajuste(1, "Aplica"));
            ListadoAjuste.Add(new Ajuste(2, "No Aplica"));
            ListadoAjuste.Add(new Ajuste(3, "Reemplazo"));
            DataGridComboBoxColumn columncombo = (DataGridComboBoxColumn)dataGrid.Columns[5];

            columncombo.ItemsSource       = ListadoAjuste;
            columncombo.DisplayMemberPath = "ajuste";
            columncombo.SelectedValuePath = "idAjuste";
        }
示例#8
0
        public void GenerateDataGridColumn(GridColumnDef column)
        {
            System.Windows.Controls.DataGridColumn col = null;

            switch (column.Type)
            {
            case ColumnType.Text:
                col = new DataGridTextColumn();
                break;

            case ColumnType.Int:
            case ColumnType.Currency:
                col = new DataGridTextColumn();
                break;

            case ColumnType.Check:
                col = new DataGridCheckBoxColumn();
                break;

            case ColumnType.Combo:
                col = new DataGridComboBoxColumn();
                break;

            case ColumnType.Template:        //Template
                col = new DataGridTemplateColumn();
                //((DataGridTemplateColumn)col).CellTemplate = dataTemplate as DataTemplate;
                break;
            }

            if (col != null)
            {
                Binding binding = null;
                if (!String.IsNullOrEmpty(column.Path))
                {
                    binding = new Binding(column.Path);
                }
                if (!String.IsNullOrEmpty(column.Header))
                {
                    col.Header = column.Header;
                }

                col.Width = column.Width;

                if (col is DataGridBoundColumn)
                {
                    ((DataGridBoundColumn)col).Binding = binding;
                }
                this.AssociatedObject.Columns.Add(col);
            }
        }
 private void DataGrid_FailureMode_AutoGeneratingColumn(object sender, DataGridAutoGeneratingColumnEventArgs e)
 {
     if (e.PropertyName == "是否产生影响")
     {
         DataGridComboBoxColumn tmpComboBoxColumn = new DataGridComboBoxColumn();
         tmpComboBoxColumn.Header = "是否产生影响";
         ObservableCollection <ComboBoxItem> lstComboboxItem = new ObservableCollection <ComboBoxItem>();
         lstComboboxItem.Add(new ComboBoxItem()
         {
             Item = "是"
         });
         lstComboboxItem.Add(new ComboBoxItem()
         {
             Item = "否"
         });
         tmpComboBoxColumn.ItemsSource       = lstComboboxItem; //设置下拉框内容的数据源
         tmpComboBoxColumn.DisplayMemberPath = "Item";          //界面初始化时展示的值
         tmpComboBoxColumn.SelectedValuePath = "Item";          //选中后展示的值
         Binding binding = new Binding();                       //实例化一个binding对象
         binding.Path = new PropertyPath("是否产生影响");             //设置需要绑定到的那一列的列名
         binding.UpdateSourceTrigger            = UpdateSourceTrigger.PropertyChanged;
         tmpComboBoxColumn.SelectedValueBinding = binding;
         e.Column = tmpComboBoxColumn;
     }
     else if (e.PropertyName == "维修方式")
     {
         DataGridComboBoxColumn tmpComboBoxColumn = new DataGridComboBoxColumn();
         tmpComboBoxColumn.Header = "维修方式";
         ObservableCollection <ComboBoxItem> lstComboboxItem = new ObservableCollection <ComboBoxItem>();
         lstComboboxItem.Add(new ComboBoxItem()
         {
             Item = "直接维修"
         });
         lstComboboxItem.Add(new ComboBoxItem()
         {
             Item = "更换维修"
         });
         tmpComboBoxColumn.ItemsSource       = lstComboboxItem; //设置下拉框内容的数据源
         tmpComboBoxColumn.DisplayMemberPath = "Item";          //界面初始化时展示的值
         tmpComboBoxColumn.SelectedValuePath = "Item";          //选中后展示的值
         Binding binding = new Binding();                       //实例化一个binding对象
         binding.Path = new PropertyPath("维修方式");               //设置需要绑定到的那一列的列名
         binding.UpdateSourceTrigger            = UpdateSourceTrigger.PropertyChanged;
         tmpComboBoxColumn.SelectedValueBinding = binding;
         e.Column = tmpComboBoxColumn;
     }
     else
     {
     }
 }
示例#10
0
        private string GetColumnKey(DataGridColumn column)
        {
            string attachedBinding = GetBindingPath(column) as string;

            if (attachedBinding != null)
            {
                return(string.IsNullOrWhiteSpace(attachedBinding) ? (string)null : attachedBinding);
            }

            string bindingPath = null;

            if (column is DataGridBoundColumn)
            {
                DataGridBoundColumn columnBound = column as DataGridBoundColumn;
                Binding             binding     = columnBound.Binding as Binding;
                if (binding != null)
                {
                    bindingPath = binding.Path.Path;
                }
            }
            else if (column is DataGridTemplateColumn)
            {
                DataGridTemplateColumn templateColumn = column as DataGridTemplateColumn;
                string header = templateColumn.Header as string;
                if (header == null)
                {
                    return(null);
                }

                bindingPath = header;
            }
            else if (column is DataGridComboBoxColumn)
            {
                DataGridComboBoxColumn comboBoxColumn = column as DataGridComboBoxColumn;
                Binding binding = comboBoxColumn.SelectedItemBinding as Binding;
                bindingPath = binding == null ? null : binding.Path.Path;
            }

            if (bindingPath == null || string.IsNullOrEmpty(bindingPath))
            {
                return(null);
            }

            if (bindingPath.Contains("."))
            {
                return(bindingPath);
            }

            return(bindingPath);
        }
        private DataGridComboBoxColumn createComboBoxColumn(string title)
        {
            DataGridComboBoxColumn col = new DataGridComboBoxColumn();

            col.Header = title;
            Binding       bind  = new Binding(title);
            List <string> items = new List <string>();

            items.Add("Yes");
            items.Add("No");
            col.SelectedItemBinding = bind;
            col.ItemsSource         = items;
            return(col);
        }
示例#12
0
        public void CreateAddCommboBoxCol(DataGrid dg, string name, string title, List <string> list, int width)
        {
            DataGridComboBoxColumn col;

            col             = new DataGridComboBoxColumn();
            col.ItemsSource = list;
            col.Header      = title;
            if (width == 0)
            {
                col.MinWidth = 0;
            }
            col.Width = width;
            col.SelectedValueBinding = new Binding(name);
            dg.Columns.Add(col);
        }
        public void SetAttributeTypes(AttributeTypeSet attributeTypesSet)
        {
            _attributeTypeSet = attributeTypesSet;

            dataGrid.Columns.Clear();

            DataGridCheckBoxColumn isUseColumn = new DataGridCheckBoxColumn()
            {
                Header  = "Использовать",
                Width   = 30,
                Binding = new Binding("IsUse")
            };

            dataGrid.Columns.Add(isUseColumn);

            for (int i = 0; i < _attributeTypeSet.PredictiveAttributeTypes.Count; i++)
            {
                DataGridComboBoxColumn predictiveAttributeTypeColumn = new DataGridComboBoxColumn()
                {
                    Header      = _attributeTypeSet.PredictiveAttributeTypes[i].Name,
                    Width       = 100,
                    ItemsSource = _attributeTypeSet.PredictiveAttributeTypes[i].Values,
                    TextBinding = new Binding("PredictiveAttributeValues[" + i + "]")
                };
                dataGrid.Columns.Add(predictiveAttributeTypeColumn);
            }

            DataGridComboBoxColumn decisiveAttributeValueColumn = new DataGridComboBoxColumn()
            {
                Header      = _attributeTypeSet.DecisiveAttributeType.Name,
                Width       = 100,
                ItemsSource = _attributeTypeSet.DecisiveAttributeType.Values,
                TextBinding = new Binding("DecisiveAttributeValue"),
                CellStyle   =
                    new Style(typeof(DataGridCell))
                {
                    Setters = { new Setter()
                                {
                                    Property = ForegroundProperty, Value = Brushes.Blue
                                } }
                }
            };

            dataGrid.Columns.Add(decisiveAttributeValueColumn);

            _items = new List <LearningExamplesDataGridItem>();
            dataGrid.ItemsSource = _items;
        }
示例#14
0
 protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e)
 {
     base.OnPropertyChanged(e);
     if (e.Property == AssociatedCellProperty || e.Property == TargetProperty)
     {
         if (AssociatedCell != null && Target != null)
         {
             DataGridComboBoxColumn column = AssociatedCell.Column as DataGridComboBoxColumn;
             if (column != null)
             {
                 Target.SetBinding(ComboBox.ItemsSourceProperty, new Binding {
                     Source = column, Path = new PropertyPath(DataGridComboBoxColumn.ItemsSourceProperty)
                 });
             }
         }
     }
 }
示例#15
0
        public UIElement BuildDictionaryForm <Y, T>(FieldInfo pi, Dictionary <Y, T> dictionary)
        {
            var natt = pi.GetCustomAttribute <NecrobotConfigAttribute>();

            string resKey = $"Setting.{pi.Name}";

            ObservablePairCollection <Y, T> dataSource = new ObservablePairCollection <Y, T>(dictionary);

            map.Add(pi, dataSource);

            DataGrid grid = new DataGrid()
            {
                IsReadOnly          = false,
                AutoGenerateColumns = false
            };

            grid.ItemsSource = dataSource;

            var col1 = new DataGridComboBoxColumn()
            {
                Header = translator.PokemonName
            };

            col1.ItemsSource = Enum.GetValues(typeof(Y)).Cast <Y>();

            col1.SelectedItemBinding = new Binding("Key")
            {
                Mode = BindingMode.TwoWay
            };
            grid.Columns.Add(col1);
            var type = typeof(T);

            foreach (var item in type.GetProperties())
            {
                var att = item.GetCustomAttribute <NecrobotConfigAttribute>(true);
                if (att != null && !att.IsPrimaryKey)
                {
                    string headerKey       = $"{resKey}.{item.Name}";
                    var    dataGridControl = GetDataGridInputControl(item);
                    dataGridControl.Header = translator.GetTranslation(headerKey);

                    grid.Columns.Add(dataGridControl);
                }
            }
            return(grid);
        }
示例#16
0
        public MainWindow()
        {
            var connectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;

            connection  = new SqlConnection(connectionString);
            adapterEmpl = new SqlDataAdapter("SELECT * FROM Employees", connection);
            var builderEmpl = new SqlCommandBuilder(adapterEmpl);

            adapterEmpl.InsertCommand = builderEmpl.GetInsertCommand();
            adapterEmpl.UpdateCommand = builderEmpl.GetUpdateCommand();
            adapterEmpl.DeleteCommand = builderEmpl.GetDeleteCommand();
            dtEmployees = new DataTable();
            adapterEmpl.Fill(dtEmployees);

            adapterDep = new SqlDataAdapter("SELECT * FROM Departments", connection);
            var builderDep = new SqlCommandBuilder(adapterDep);

            adapterDep.InsertCommand = builderDep.GetInsertCommand();
            adapterDep.UpdateCommand = builderDep.GetUpdateCommand();
            adapterDep.DeleteCommand = builderDep.GetDeleteCommand();
            dtDepartments            = new DataTable();
            adapterDep.Fill(dtDepartments);



            InitializeComponent();

            dgEmpl.DataContext = dtEmployees;
            dgEmpl.ItemsSource = dtEmployees.DefaultView;
            DataGridComboBoxColumn dgvCmb = new DataGridComboBoxColumn();

            dgvCmb.ItemsSource       = dtDepartments.DefaultView;
            dgvCmb.DisplayMemberPath = "Name";
            dgvCmb.SelectedValuePath = "ID";
            //dgvCmb.SelectedItemBinding = new Binding("DepartmentID");
            // dgvCmb.TextBinding = new Binding("DepartmentID");



            dgvCmb.Width  = 90;
            dgvCmb.Header = "Department";
            dgEmpl.Columns.Add(dgvCmb);

            dgDep.DataContext = dtDepartments;
            dgDep.ItemsSource = dtDepartments.DefaultView;
        }
示例#17
0
        public override void SetDgColumns()
        {
            DataGridTextColumn bezeichnung = new DataGridTextColumn();

            bezeichnung.Width   = new DataGridLength(100, DataGridLengthUnitType.Star);
            bezeichnung.Header  = "Bezeichnung";
            bezeichnung.Binding = new Binding("sBezeichnung");
            uiDgObjekte.Columns.Add(bezeichnung);

            DataGridComboBoxColumn modell = new DataGridComboBoxColumn();

            modell.Width  = new DataGridLength(50, DataGridLengthUnitType.Star);
            modell.Header = "Modell";
            modell.SelectedValueBinding      = new Binding("mod_iId");
            modell.SelectedValuePath         = "iId";
            modell.DisplayMemberPath         = "sBezeichnung";
            dataGridComboBoxes["Modell_mod"] = modell;
            uiDgObjekte.Columns.Add(modell);

            DataGridComboBoxColumn farbe = new DataGridComboBoxColumn();

            farbe.Width  = new DataGridLength(50, DataGridLengthUnitType.Star);
            farbe.Header = "Farbe";
            farbe.SelectedValueBinding      = new Binding("fab_iId");
            farbe.SelectedValuePath         = "iId";
            farbe.DisplayMemberPath         = "sBezeichnung";
            dataGridComboBoxes["Farbe_fab"] = farbe;
            uiDgObjekte.Columns.Add(farbe);

            DataGridComboBoxColumn groesse = new DataGridComboBoxColumn();

            groesse.Width  = new DataGridLength(50, DataGridLengthUnitType.Pixel);
            groesse.Header = "Größe";
            groesse.SelectedValueBinding      = new Binding("gro_iId");
            groesse.SelectedValuePath         = "iId";
            groesse.DisplayMemberPath         = "rGroesse";
            dataGridComboBoxes["Groesse_gro"] = groesse;
            uiDgObjekte.Columns.Add(groesse);

            DataGridTextColumn art = new DataGridTextColumn();

            art.Width   = new DataGridLength(100, DataGridLengthUnitType.Pixel);
            art.Header  = "Artikel Nummer";
            art.Binding = new Binding("iArtNr");
            uiDgObjekte.Columns.Add(art);
        }
示例#18
0
        private void addDropDownColumnToListView(string columnName, string binding, int width)
        {
            DataGridComboBoxColumn dgCB = new DataGridComboBoxColumn();

            dgCB.Header = columnName;
            Binding b = new Binding(binding);

            b.Mode = BindingMode.TwoWay;
            dgCB.SelectedValueBinding = new Binding(binding);
            dgCB.Width = 100;
            List <String> options2 = new List <string>()
            {
                "", "Modify", "Read"
            };

            dgCB.ItemsSource = options2;
            dgPermissions.Columns.Add(dgCB);
        }
示例#19
0
        public void SetComboBoxColumn(int index, Dictionary <string, string> dict)
        {
            var column = GetDataGridColumn(index) as DataGridTextColumn;

            if (column == null)
            {
                return;
            }
            var cbbColumn = new DataGridComboBoxColumn();

            cbbColumn.Header               = column.Header;
            cbbColumn.ItemsSource          = dict;
            cbbColumn.SelectedValuePath    = "Value";
            cbbColumn.DisplayMemberPath    = "Key";
            cbbColumn.SelectedValueBinding = column.Binding;
            dg_Host.Columns.Insert(index, cbbColumn);
            dg_Host.Columns.Remove(column);
        }
        public static void AddColumn(Window w, DataGrid dg, ColumnSpec cs, Binding b)
        {
            DataGridColumn col = null;

            switch (cs.ColumnType)
            {
            case ColumnType.CHECKBOX:
            {
                col = new DataGridCheckBoxColumn();
                ((DataGridCheckBoxColumn)col).Binding = b;
                break;
            }

            case ColumnType.TEXTBOX:
            {
                col = new DataGridTextColumn();
                ((DataGridTextColumn)col).Binding = b;
                break;
            }

            case ColumnType.DROPDOWN:
            {
                col = new DataGridComboBoxColumn();
                ((DataGridComboBoxColumn)col).ItemsSource         = cs.Choices.ChoiceList;
                ((DataGridComboBoxColumn)col).SelectedItemBinding = b;
                break;
            }
            }

//			DataTemplate dt = (DataTemplate) w.FindResource("HeaderTemplate1");
            Style dt = (Style)w.FindResource("DataGridColumnHeaderStyle3");

            if (cs.ColumnWidth > 0)
            {
                col.Width = cs.ColumnWidth;
            }

            col.Header = cs;
//			col.HeaderTemplate = dt;
            col.HeaderStyle = dt;


            dg.Columns.Add(col);
        }
示例#21
0
    private void DataGridMyItems_AutoGeneratingColumn(object sender, DataGridAutoGeneratingColumnEventArgs e)
    {
        var desc = e.PropertyDescriptor as PropertyDescriptor;
        var att  = desc.Attributes[typeof(ColumnNameAttribute)] as ColumnNameAttribute;

        if (att != null)
        {
            if (att.Name == "My Combobox Item")
            {
                var comboBoxColumn = new DataGridComboBoxColumn {
                    DisplayMemberPath    = "Value",
                    SelectedValuePath    = "Key",
                    ItemsSource          = _ApprovalTypes,
                    SelectedValueBinding = new Binding("Bazinga"),
                };
                e.Column = comboBoxColumn;
            }
        }
    }
        private void HandleListFilterType()
        {
            if (FilterCurrentData.Type == FilterType.List)
            {
                ComboBox comboBox             = this.Template.FindName("PART_ComboBoxFilter", this) as ComboBox;
                DataGridComboBoxColumn column = AssignedDataGridColumn as DataGridComboBoxColumn;

                if (comboBox != null && column != null)
                {
                    if (DataGridComboBoxExtensions.GetIsTextFilter(column))
                    {
                        FilterCurrentData.Type = FilterType.Text;
                        InitControlType();
                    }
                    else //list filter type
                    {
                        Binding columnItemsSourceBinding = BindingOperations.GetBinding(column, DataGridComboBoxColumn.ItemsSourceProperty);

                        if (columnItemsSourceBinding == null)
                        {
                            Setter styleSetter = column
                                                 .EditingElementStyle
                                                 .Setters
                                                 .FirstOrDefault(s => ((Setter)s).Property == DataGridComboBoxColumn.ItemsSourceProperty) as Setter;
                            if (styleSetter != null)
                            {
                                columnItemsSourceBinding = styleSetter.Value as Binding;
                            }
                        }

                        comboBox.DisplayMemberPath = column.DisplayMemberPath;
                        comboBox.SelectedValuePath = column.SelectedValuePath;

                        if (columnItemsSourceBinding != null)
                        {
                            BindingOperations.SetBinding(comboBox, ItemsControl.ItemsSourceProperty, columnItemsSourceBinding);
                        }

                        comboBox.RequestBringIntoView += SetComboBindingAndHanldeUnsetValue;
                    }
                }
            }
        }
示例#23
0
        private static void dg_AutoGeneratingColumn(object sender, DataGridAutoGeneratingColumnEventArgs e)
        {
            var pd = (PropertyDescriptor)e.PropertyDescriptor;

            if (pd.Attributes.OfType <BrowsableAttribute>()?.SingleOrDefault()?.Browsable ?? true)
            {
                var txtCol = e.Column as DataGridTextColumn;

                var enumType = pd.Attributes.OfType <EnumDataTypeAttribute>()?.SingleOrDefault()?.EnumType;
                if (enumType != null && txtCol != null)
                {
                    var cbCol = e.Column as DataGridComboBoxColumn;
                    if (cbCol == null)
                    {
                        cbCol = new DataGridComboBoxColumn();
                        var intType = Enum.GetUnderlyingType(enumType);
                        cbCol.ItemsSource = Enum.GetValues(enumType)
                                            .Cast <Enum>()
                                            .ToDictionary(i => Convert.ChangeType(i, intType), i => i.ToString());
                        cbCol.SelectedValueBinding = txtCol.Binding;
                        cbCol.SelectedValuePath    = "Key";
                        cbCol.DisplayMemberPath    = "Value";
                    }
                    e.Column = cbCol;
                }

                e.Column.IsReadOnly = !(pd.Attributes.OfType <EditableAttribute>()?.SingleOrDefault()?.AllowEdit ?? true);
                var attr = pd.Attributes.OfType <DisplayAttribute>().FirstOrDefault();
                if (attr != null)
                {
                    e.Column.Header = attr.ShortName ?? attr.Name ?? attr.Description ?? e.PropertyName;
                }
                else
                {
                    e.Column.Header = pd.Attributes.OfType <DisplayNameAttribute>()?.SingleOrDefault()?.DisplayName ?? e.PropertyName;
                }
            }
            else
            {
                e.Cancel = true;
            }
        }
示例#24
0
        public DataGridColumn GetNewComboBoxColumn(string header, string bindingPath, object itemsSource)
        {
            DataGridComboBoxColumn comboBoxColumn = new DataGridComboBoxColumn();

            comboBoxColumn.Header            = header;
            comboBoxColumn.SelectedValuePath = "MA";
            comboBoxColumn.DisplayMemberPath = "TEN";

            Binding binding = new Binding();

            binding.Path = new PropertyPath(bindingPath);
            comboBoxColumn.SelectedValueBinding = binding;

            Binding itemsSourceBinding = new Binding();

            itemsSourceBinding.Source = itemsSource;
            BindingOperations.SetBinding(comboBoxColumn, DataGridComboBoxColumn.ItemsSourceProperty, itemsSourceBinding);

            return(comboBoxColumn);
        }
        protected virtual void AutoGenColumns(DataGridAutoGeneratingColumnEventArgs e)
        {
            if (e.PropertyName == "id")
            {
                e.Column.IsReadOnly = true;
            }
            if (e.PropertyName == "batchNo")
            {
                e.Cancel = true;
                return;
            }
            else
            {
                if (e.PropertyName == "materialId")
                {
                    var templateColumn = new DataGridComboBoxColumn();

                    templateColumn.ItemsSource = Materials;

                    templateColumn.DisplayMemberPath = "name";
                    templateColumn.SelectedValuePath = "id";
                    var binding = new Binding("materialId");
                    binding.UpdateSourceTrigger         = UpdateSourceTrigger.PropertyChanged;
                    templateColumn.SelectedValueBinding = binding;
                    e.Column = templateColumn;
                }
                else if (e.PropertyName == "tonnageId")
                {
                    var templateColumn = new DataGridComboBoxColumn();
                    templateColumn.ItemsSource       = Tonnages;
                    templateColumn.DisplayMemberPath = "tonnage";
                    templateColumn.SelectedValuePath = "id";
                    var binding = new Binding("tonnageId");
                    binding.UpdateSourceTrigger         = UpdateSourceTrigger.PropertyChanged;
                    templateColumn.SelectedValueBinding = binding;
                    e.Column = templateColumn;
                }
                e.Column.Header = e.PropertyName;
                //e.Column.Header = data["Metal"][e.PropertyName];
            }
        }
示例#26
0

        
示例#27
0
        private void QueryBuilder1_OnQueryElementControlCreated(QueryElement owner, IQueryElementControl control)
        {
            if (!(control is IQueryColumnListControl))
            {
                return;
            }

            var queryColumnListControl = (IQueryColumnListControl)control;
            var dataGridView           = (DataGrid)queryColumnListControl.DataGrid;

            // Create custom column
            var customColumn = new DataGridComboBoxColumn()
            {
                Header      = "Custom Column",
                Width       = new DataGridLength(200),
                HeaderStyle =
                    new Style
                {
                    Setters =
                    {
                        new Setter(FontFamilyProperty, new FontFamily("Tahoma")),
                        new Setter(FontWeightProperty, FontWeights.Bold)
                    }
                },
                ItemsSource = _customValuesProvider,

                // Bind this column to the QueryColumnListItem.CustomData object, which is expected to be a string.
                SelectedItemBinding = new Binding("CustomData")
                {
                    UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged
                }
            };

            // Insert new column to the specified position
            dataGridView.Columns.Insert(2, customColumn);

            // Handle the necessary events
            dataGridView.BeginningEdit  += DataGridView_BeginningEdit;
            dataGridView.CellEditEnding += DataGridView_CellEditEnding;
            dataGridView.LoadingRow     += dataGridView_LoadingRow;
        }
示例#28
0
        protected void SetupDataGridItemsSource()
        {
            DataGrid.Items.Clear();
            ObservableCollection <ConstrainedDataGridItem> observableCollection = new ObservableCollection <ConstrainedDataGridItem>(ItemsSource);

            DataGrid.ItemsSource = observableCollection;

            DataGrid.Measure(Window.RenderSize);
            if (DataGrid.AutoGenerateColumns == false)
            {
                PropertyInfo[] props = typeof(ConstrainedDataGridItem).GetProperties();
                for (int i = 0; i < props.Length; i++)
                {
                    DataGridColumn col = null;
                    if (props[i].PropertyType == typeof(Boolean))
                    {
                        col = new DataGridCheckBoxColumn();
                    }
                    if (props[i].PropertyType == typeof(Enumerations))
                    {
                        col = new DataGridComboBoxColumn();
                        Array array = Enum.GetNames(typeof(Enumerations));
                        ((DataGridComboBoxColumn)col).ItemsSource = array;
                    }
                    if (props[i].PropertyType == typeof(Uri))
                    {
                        col = new DataGridHyperlinkColumn();
                        ((DataGridHyperlinkColumn)col).ContentBinding = new Binding(props[i].Name);
                    }
                    else
                    {
                        col = new DataGridTextColumn();
                    }
                    DataGrid.Columns.Add(col);
                }
                DataGrid.UpdateLayout();
            }

            Window.Content = DataGrid;
        }
示例#29
0
        public UIElement BuildDictionaryForm <T>(FieldInfo pi, Dictionary <PokemonId, T> dictionary)
        {
            ObservablePairCollection <PokemonId, T> dataSource = new ObservablePairCollection <PokemonId, T>(dictionary);

            map.Add(pi, dataSource);

            DataGrid grid = new DataGrid()
            {
                IsReadOnly          = false,
                AutoGenerateColumns = false
            };

            grid.ItemsSource = dataSource;

            var col1 = new DataGridComboBoxColumn()
            {
                Header = "Pokemon Name"
            };

            col1.ItemsSource = Enum.GetValues(typeof(PokemonId)).Cast <PokemonId>();

            col1.SelectedItemBinding = new Binding("Key")
            {
                Mode = BindingMode.TwoWay
            };
            grid.Columns.Add(col1);
            var type = typeof(T);

            foreach (var item in type.GetProperties())
            {
                var att = item.GetCustomAttribute <ExcelConfigAttribute>(true);
                if (att != null && !att.IsPrimaryKey)
                {
                    var dataGridControl = GetDataGridInputControl(item);
                    grid.Columns.Add(dataGridControl);
                }
            }
            return(grid);
        }
示例#30
0
        private void FillGrid()
        {
            this.Show();
            Class.configChanged  = false;
            Class.configIterator = 0;
            DataGridCheckBoxColumn checkVersion;
            DataGridComboBoxColumn cmbBoxCol;
            DataGridTextColumn     textColumn;

            string[] colNames = new string[] { "Конфигурация", "Обозначение", "Наименование", "Масса" };
            foreach (var item in colNames)
            {
                textColumn         = new DataGridTextColumn();
                textColumn.Header  = item;
                textColumn.Binding = new Binding(item);
                if (item == "Конфигурация")
                {
                    textColumn.IsReadOnly = true;
                }
                dataGrid.Columns.Add(textColumn);
            }

            // COMBOBOX
            cmbBoxCol                     = new DataGridComboBoxColumn();
            cmbBoxCol.Header              = "Раздел";
            cmbBoxCol.ItemsSource         = Class.razdel;
            cmbBoxCol.SelectedItemBinding = new Binding("Раздел");
            dataGrid.Columns.Add(cmbBoxCol);

            //CHECHBOX
            checkVersion              = new DataGridCheckBoxColumn();
            checkVersion.Header       = "Версия";
            checkVersion.IsThreeState = false;
            checkVersion.Binding      = new Binding("Версия");
            dataGrid.Columns.Add(checkVersion);

            dataGrid.ItemsSource = WorkWithCommonConfFixer.PropertiesForEachConf().AsDataView();
        }
示例#31
0
        private void BindData()
        {
            this.prepareDataSet();
            DataTable dtParam = parameterDataSet.Tables[0];
            DataTable dtType  = this.prepareDataTableForType();

            DataGridTableStyle tableStyle = new DataGridTableStyle();

            tableStyle.MappingName = "ParamTable";
            DataGridComboBoxColumn ComboTextCol = new DataGridComboBoxColumn(this.parameterGrid, dtParam, "paramtype");

            for (int i = 0; i < dtParam.Columns.Count; ++i)
            {
                if (dtParam.Columns[i].ColumnName != "paramtype")
                {
                    DataGridColorTextBoxColumn TextCol = new DataGridColorTextBoxColumn(parameterGrid, dtParam, dtParam.Columns[i].ColumnName);
                    TextCol.MappingName = dtParam.Columns[i].ColumnName;
                    TextCol.HeaderText  = dtParam.Columns[i].ColumnName;
                    TextCol.Width       = 95;
                    tableStyle.GridColumnStyles.Add(TextCol);
                }
                else
                {
                    ComboTextCol.MappingName = "paramtype"; //must be from the lattice table...
                    ComboTextCol.HeaderText  = "Type";
                    ComboTextCol.Width       = 150;
                    ComboTextCol.ColumnComboBox.DataSource    = dtType;
                    ComboTextCol.ColumnComboBox.DisplayMember = "paramType"; //use for display value in combo
                    ComboTextCol.ColumnComboBox.ValueMember   = "paramType"; // also use for value member in combo
                    tableStyle.PreferredRowHeight             = ComboTextCol.ColumnComboBox.Height + 2;
                    tableStyle.GridColumnStyles.Add(ComboTextCol);
                }
            }
            parameterGrid.TableStyles.Clear();
            parameterGrid.TableStyles.Add(tableStyle);
            parameterGrid.DataSource = dtParam;
        }
示例#32
0
文件: AutoDataGrid.cs 项目: JuRogn/OA
        private DataGridColumn GetDataGridColumn(GridItem gItem)
        {
            Binding bding = new Binding();
            if (!string.IsNullOrEmpty(gItem.PropertyName))
            {
                bding.Mode = BindingMode.TwoWay;
                bding.Path = new PropertyPath(gItem.PropertyName);
                if (gItem.ReferenceDataInfo != null)
                {
                    IValueConverter converter = CommonFunction.GetIValueConverter(gItem.ReferenceDataInfo.Type);
                    bding.Converter = converter;
                }
                else if (gItem.PropertyName.Contains("MONEY"))
                {
                    IValueConverter converter = new CurrencyConverter();
                    bding.Converter = converter;
                }
                else
                {
                    IValueConverter converter = new CommonConvert(gItem);
                    bding.Converter = converter;
                }
                
            }
            else
            {
                System.Diagnostics.Debug.WriteLine("");
            }

            DataGridColumn dgc = null;
            switch (gItem.CType)
            {
                case ControlType.CheckBox :
                    DataGridCheckBoxColumn dgcc = new DataGridCheckBoxColumn();
                    dgcc.IsThreeState = false;
                    dgcc.Binding = bding;
                    dgc = dgcc;
                    break;
                case ControlType.Label :
                    if (gItem.ReferenceDataInfo != null)
                    {
                        DataGridReferenceColumn dgrc = new DataGridReferenceColumn();
                        dgrc.Binding = bding;
                        dgrc.DisplayMemberPath = "Text";
                        
                        dgc = dgrc;

                    }
                    else
                    {
                        DataGridTextColumn dgtc = new MyDataGridTextColumn(gItem);
                        dgtc.Binding = bding;
                        dgc = dgtc;
                    }
                    break;

                case ControlType.Combobox :

                    DataGridComboBoxColumn dgcbc = new DataGridComboBoxColumn();
                    if (gItem.ReferenceDataInfo != null)
                    {
                        IList<ITextValueItem> list = DataCore.GetRefData(gItem.ReferenceDataInfo.Type);
                        dgcbc.ItemsSource = list;
                    }
                    dgcbc.DisplayMemberPath = "Text";
                    dgcbc.Binding = bding;

                    dgc = dgcbc;
                    break;

                case ControlType.TreeViewItem :
                    DataGridIconColumn dgtvic = new DataGridIconColumn();
                    dgtvic.Binding = bding;
                    dgc = dgtvic;
                    break;
                case ControlType.Templete:
                    
                     //"<StackPanel Orientation="Horizontal"><smtx:ImageButton x:Name="myDelete" Click="Delete_Click"/></StackPanel>"
                    var gridXCs = new XElementString("StackPanel",new XAttributeString("Orientation", "Horizontal"));
                  
                    DataGridTemplateColumn dtc = new DataGridTemplateColumn();
                    dtc.CellTemplate = DataTemplateHelper.GetDataTemplate(gridXCs);
                    dgc = dtc;
                    break;
            }

            return dgc;
        }
示例#33
0
        private void BindData()
        {
            this.prepareDataSet();
            DataTable dtParam = parameterDataSet.Tables[0];
            DataTable dtType = this.prepareDataTableForType();

            DataGridTableStyle tableStyle = new DataGridTableStyle();
            tableStyle.MappingName = "ParamTable";
            DataGridComboBoxColumn ComboTextCol = new DataGridComboBoxColumn(this.parameterGrid, dtParam, "paramtype");
            for (int i = 0; i < dtParam.Columns.Count; ++i)
            {
                if (dtParam.Columns[i].ColumnName != "paramtype")
                {
                    DataGridColorTextBoxColumn TextCol = new DataGridColorTextBoxColumn(parameterGrid, dtParam, dtParam.Columns[i].ColumnName);
                    TextCol.MappingName = dtParam.Columns[i].ColumnName;
                    TextCol.HeaderText = dtParam.Columns[i].ColumnName;
                    TextCol.Width = 95;
                    tableStyle.GridColumnStyles.Add(TextCol);
                }
                else
                {
                    ComboTextCol.MappingName = "paramtype"; //must be from the lattice table...
                    ComboTextCol.HeaderText = "Type";
                    ComboTextCol.Width = 150;
                    ComboTextCol.ColumnComboBox.DataSource = dtType;
                    ComboTextCol.ColumnComboBox.DisplayMember = "paramType"; //use for display value in combo
                    ComboTextCol.ColumnComboBox.ValueMember = "paramType"; // also use for value member in combo
                    tableStyle.PreferredRowHeight = ComboTextCol.ColumnComboBox.Height + 2;
                    tableStyle.GridColumnStyles.Add(ComboTextCol);
                }
            }
            parameterGrid.TableStyles.Clear();
            parameterGrid.TableStyles.Add(tableStyle);
            parameterGrid.DataSource = dtParam;
        }
        /// <summary>
        /// Helper Method which creates a default DataGridColumn object for the specified property type.
        /// </summary>
        /// <param name="itemProperty"></param>
        /// <returns></returns>
        internal static DataGridColumn CreateDefaultColumn(ItemPropertyInfo itemProperty)
        {
            Debug.Assert(itemProperty != null && itemProperty.PropertyType != null, "itemProperty and/or its PropertyType member cannot be null");

            DataGridColumn dataGridColumn = null;
            DataGridComboBoxColumn comboBoxColumn = null;
            Type propertyType = itemProperty.PropertyType;
            
            // determine the type of column to be created and create one
            if (propertyType.IsEnum)
            {
                comboBoxColumn = new DataGridComboBoxColumn();
                comboBoxColumn.ItemsSource = Enum.GetValues(propertyType);
                dataGridColumn = comboBoxColumn;
            }
            else if (typeof(string).IsAssignableFrom(propertyType))
            {
                dataGridColumn = new DataGridTextColumn();
            }
            else if (typeof(bool).IsAssignableFrom(propertyType))
            {
                dataGridColumn = new DataGridCheckBoxColumn();
            }
            else if (typeof(Uri).IsAssignableFrom(propertyType))
            {
                dataGridColumn = new DataGridHyperlinkColumn();
            }           
            else
            {
                dataGridColumn = new DataGridTextColumn();
            }

            // determine if the datagrid can sort on the column or not
            if (!typeof(IComparable).IsAssignableFrom(propertyType))
            {
                dataGridColumn.CanUserSort = false;
            }

            dataGridColumn.Header = itemProperty.Name;

            // Set the data field binding for such created columns and 
            // choose the BindingMode based on editability of the property.
            DataGridBoundColumn boundColumn = dataGridColumn as DataGridBoundColumn;
            if (boundColumn != null || comboBoxColumn != null)
            {
                Binding binding = new Binding(itemProperty.Name);
                if (comboBoxColumn != null)
                {
                    comboBoxColumn.SelectedItemBinding = binding;
                }
                else
                {
                    boundColumn.Binding = binding;
                }

                PropertyDescriptor pd = itemProperty.Descriptor as PropertyDescriptor;
                if (pd != null)
                {
                    if (pd.IsReadOnly)
                    {
                        binding.Mode = BindingMode.OneWay;
                        dataGridColumn.IsReadOnly = true;
                    }
                }
                else
                {
                    PropertyInfo pi = itemProperty.Descriptor as PropertyInfo;
                    if (pi != null)
                    {
                        if (!pi.CanWrite)
                        {
                            binding.Mode = BindingMode.OneWay;
                            dataGridColumn.IsReadOnly = true;
                        }
                    }
                }
            }

            return dataGridColumn;
        }