/// <summary> /// Add's a column definition /// </summary> /// <param name="displayName">Column header</param> /// <param name="propertyType">Type of the property/column</param> /// <param name="propertyName">Name/identifier of the column/property</param> /// <param name="sourcePropertyName">Name of the property/column from the data source</param> public FlexColumnDefinition AddColumn(string displayName, Type propertyType, string propertyName, string sourcePropertyName) { var col = new FlexColumnDefinition(displayName, propertyType, propertyName, sourcePropertyName); this.AddColumn(col); //this.columnHeaders.Add(displayName); //this.columnIdentifierValues.Add(propertyName); return(col); }
/// <summary> /// Adds the specified column name. /// </summary> /// <param name="columnName">Name of the column.</param> /// <param name="columnType">Type of the column.</param> /// <returns></returns> public FlexColumnDefinition Add(string columnTitle, Type columnType, string columnPropertyName) { var newColDefinition = new FlexColumnDefinition(columnTitle, columnType, columnPropertyName); this.columnDictionary.Add(columnPropertyName, newColDefinition); this.columns.Add(newColDefinition); newColDefinition.Index = this.Count; newColDefinition.ParentCollection = this; return(newColDefinition); }
/// <summary> /// Adds a column definition /// </summary> /// <param name="column">the column definition</param> public void AddColumn(FlexColumnDefinition column) { this.ColumnDefinitions.Add(column); this.columnHeaders.Add(column.ColumnTitle); this.columnIdentifierValues.Add(column.ColumnPropertyName); // create a property descriptor, which helps Reflection var cpd = new ColumnPropertyDescriptor(column.ColumnPropertyName, column.ColumnTitle, column.ColumnType, PivotColumnType.NonPivotColumn, column.SourcePropertyName); this.columnDescriptors.Add(cpd); column.ColumnPropertyDescriptor = cpd; // add the new column to all existing rows of this collection foreach (var row in this) { row.AddColumn(cpd); } }