示例#1
0
        /// <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);
            }
        }
示例#2
0
        internal void AddColumn(ColumnPropertyDescriptor pdc)
        {
            Debug.Assert(this.values.ContainsKey(pdc.PropertyName) == false, string.Format("The property {0} is already part of the column list.", pdc.PropertyName));

            if (pdc.PropertyType == typeof(ProxyProperty))
            {
                this.values.Add(pdc.PropertyName, new ProxyProperty(this, pdc.PropertyName, pdc.DisplayName));
            }
            else
            {
                this.values.Add(pdc.PropertyName, null);
            }

            this.InitializeColumn(pdc.PropertyName);

            if (this.propertyDescriptors.Contains(pdc) == false)
            {
                this.propertyDescriptors.Add(pdc);
            }
        }