/// <include file='doc\DataGridColumnCollection.uex' path='docs/doc[@for="GridColumnStylesCollection.Add"]/*' /> /// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public virtual int Add(DataGridColumnStyle column) { if (this.isDefault) { throw new ArgumentException(SR.GetString(SR.DataGridDefaultColumnCollectionChanged)); } CheckForMappingNameDuplicates(column); column.SetDataGridTableInColumn(owner, true); column.MappingNameChanged += new EventHandler(ColumnStyleMappingNameChanged); column.PropertyDescriptorChanged += new EventHandler(ColumnStylePropDescChanged); // columns which are not the default should have a default // width of DataGrid.PreferredColumnWidth if (this.DataGridTableStyle != null && column.Width == -1) { column.width = this.DataGridTableStyle.PreferredColumnWidth; } #if false column.AddOnPropertyChanged(owner.OnColumnChanged); #endif int index = items.Add(column); OnCollectionChanged(new CollectionChangeEventArgs(CollectionChangeAction.Add, column)); return(index); }
// the dataGrid will need to add default columns to a default // table when there is no match for the listName in the tableStyle internal void AddDefaultColumn(DataGridColumnStyle column) { #if DEBUG Debug.Assert(this.isDefault, "we should be calling this function only for default tables"); Debug.Assert(column.IsDefault, "we should be a default column"); #endif // DEBUG column.SetDataGridTableInColumn(owner, true); this.items.Add(column); }
public void RemoveAt(int index) { if (this.isDefault) { throw new ArgumentException(System.Windows.Forms.SR.GetString("DataGridDefaultColumnCollectionChanged")); } DataGridColumnStyle element = (DataGridColumnStyle)this.items[index]; element.SetDataGridTableInColumn(null, true); element.MappingNameChanged -= new EventHandler(this.ColumnStyleMappingNameChanged); element.PropertyDescriptorChanged -= new EventHandler(this.ColumnStylePropDescChanged); this.items.RemoveAt(index); this.OnCollectionChanged(new CollectionChangeEventArgs(CollectionChangeAction.Remove, element)); }
/// <include file='doc\DataGridColumnCollection.uex' path='docs/doc[@for="GridColumnStylesCollection.RemoveAt"]/*' /> /// <devdoc> /// <para>Removes the System.Windows.Forms.DataGridColumnStyle with the specified index from the System.Windows.Forms.GridColumnsStyleCollection.</para> /// </devdoc> public void RemoveAt(int index) { if (this.isDefault) { throw new ArgumentException(SR.GetString(SR.DataGridDefaultColumnCollectionChanged)); } DataGridColumnStyle toRemove = (DataGridColumnStyle)items[index]; toRemove.SetDataGridTableInColumn(null, true); toRemove.MappingNameChanged -= new EventHandler(ColumnStyleMappingNameChanged); toRemove.PropertyDescriptorChanged -= new EventHandler(ColumnStylePropDescChanged); #if false toRemove.RemoveOnPropertyChange(owner.OnColumnChanged); #endif items.RemoveAt(index); OnCollectionChanged(new CollectionChangeEventArgs(CollectionChangeAction.Remove, toRemove)); }
public virtual int Add(DataGridColumnStyle column) { if (this.isDefault) { throw new ArgumentException(System.Windows.Forms.SR.GetString("DataGridDefaultColumnCollectionChanged")); } this.CheckForMappingNameDuplicates(column); column.SetDataGridTableInColumn(this.owner, true); column.MappingNameChanged += new EventHandler(this.ColumnStyleMappingNameChanged); column.PropertyDescriptorChanged += new EventHandler(this.ColumnStylePropDescChanged); if ((this.DataGridTableStyle != null) && (column.Width == -1)) { column.width = this.DataGridTableStyle.PreferredColumnWidth; } int num = this.items.Add(column); this.OnCollectionChanged(new CollectionChangeEventArgs(CollectionChangeAction.Add, column)); return num; }
public virtual int Add(DataGridColumnStyle column) { if (this.isDefault) { throw new ArgumentException(System.Windows.Forms.SR.GetString("DataGridDefaultColumnCollectionChanged")); } this.CheckForMappingNameDuplicates(column); column.SetDataGridTableInColumn(this.owner, true); column.MappingNameChanged += new EventHandler(this.ColumnStyleMappingNameChanged); column.PropertyDescriptorChanged += new EventHandler(this.ColumnStylePropDescChanged); if ((this.DataGridTableStyle != null) && (column.Width == -1)) { column.width = this.DataGridTableStyle.PreferredColumnWidth; } int num = this.items.Add(column); this.OnCollectionChanged(new CollectionChangeEventArgs(CollectionChangeAction.Add, column)); return(num); }
internal void AddDefaultColumn(DataGridColumnStyle column) { column.SetDataGridTableInColumn(this.owner, true); this.items.Add(column); }
/// <include file='doc\DataGridColumnCollection.uex' path='docs/doc[@for="GridColumnStylesCollection.Add"]/*' /> /// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public virtual int Add(DataGridColumnStyle column) { if (this.isDefault) { throw new ArgumentException(SR.GetString(SR.DataGridDefaultColumnCollectionChanged)); } CheckForMappingNameDuplicates(column); column.SetDataGridTableInColumn(owner, true); column.MappingNameChanged += new EventHandler(ColumnStyleMappingNameChanged); column.PropertyDescriptorChanged += new EventHandler(ColumnStylePropDescChanged); // columns which are not the default should have a default // width of DataGrid.PreferredColumnWidth if (this.DataGridTableStyle != null && column.Width == -1) column.width = this.DataGridTableStyle.PreferredColumnWidth; #if false column.AddOnPropertyChanged(owner.OnColumnChanged); #endif int index = items.Add(column); OnCollectionChanged(new CollectionChangeEventArgs(CollectionChangeAction.Add, column)); return index; }