当前位置: 首页>>代码示例>>C#>>正文


C# ColumnCollection.Add方法代码示例

本文整理汇总了C#中ColumnCollection.Add方法的典型用法代码示例。如果您正苦于以下问题:C# ColumnCollection.Add方法的具体用法?C# ColumnCollection.Add怎么用?C# ColumnCollection.Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ColumnCollection的用法示例。


在下文中一共展示了ColumnCollection.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CollectionWith2Columns

		private ColumnCollection CollectionWith2Columns()
		{
			ColumnCollection cc = new ColumnCollection();
			cc.Add (new SortColumn("Column1",typeof(System.String)));
			cc.Add(new SortColumn("Column2",System.ComponentModel.ListSortDirection.Ascending,typeof(System.String),true));
			return cc;
			        
		}
开发者ID:hpsa,项目名称:SharpDevelop,代码行数:8,代码来源:ColumnCollectionFixture.cs

示例2: AddColumnsInternal

        private static void AddColumnsInternal(ColumnCollection columns, Type itemType, IPageableList owner, string prefix = null, string tableName = null)
        {
            var props = itemType.GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.FlattenHierarchy);
            foreach (var prop in props)
            {
                if (prop.Name == Constants.BaseInfoPropertyName) // Add columns from the "base" classes
                {
                    var method = prop.PropertyType.GetMethod("GetProcessDefinition",
                                                             BindingFlags.Static | BindingFlags.Public);

                    var procDefinition = method.Invoke(null, BindingFlags.InvokeMethod, null, null, null);
                    var table = ((ProcessDefinition)procDefinition).TableList.Last().Name;

                    AddColumnsInternal(columns,prop.PropertyType, owner,
                                       string.IsNullOrEmpty(prefix)
                                           ? Constants.BaseInfoPropertyName
                                           : string.Format("{0}.{1}", prefix, Constants.BaseInfoPropertyName), table);
                }

                var display = (from d in prop.GetCustomAttributes(typeof(DisplayAttribute), false) select d).FirstOrDefault();
                var crossRef = (CrossRefFieldAttribute) (from d in prop.GetCustomAttributes(typeof(CrossRefFieldAttribute), false) select d).FirstOrDefault();
                if (display == null || string.IsNullOrEmpty(((DisplayAttribute)display).Name)) continue;
                var column = ColumnFactory.CreateColumn(owner, columns, crossRef);
                column.Header = ((DisplayAttribute) display).Name;
                //ColumnName =
                                    //    (crossRef == null || string.IsNullOrWhiteSpace(crossRef.RefFieldName))
                                    //        ? prop.Name
                                    //        : crossRef.RefFieldName,
                column.ReferenceTableName = (crossRef == null || string.IsNullOrWhiteSpace(crossRef.ReferenceTableName))
                                                ? string.Empty
                                                : crossRef.ReferenceTableName;
                                    //Width = getWidth(prop),
                column.IsBase = !string.IsNullOrWhiteSpace(prefix);
                column.ColumnName = prop.Name;
                column.Property = prop;
                column.Prefix = prefix;
                column.TableName = tableName;
                column.Width = prop.PropertyType == typeof (string) ? 200 : 50;

                // this cycle is need only to display hyperlink column for field file.
                // search for an item with the equals name, but only at the end + "Url",
                // if found, write AdditionalDataPropertyName item name + "Url"
                foreach (var prop1 in props)
                {
                    if (prop1.Name.EndsWith("Url") && prop1.Name.Remove(prop1.Name.Length - 3, 3) == prop.Name)
                    {
                        column.AdditionalDataPropertyName = prop1.Name;
                        break;
                    }
                }

                columns.Add(column);
            }
            

            //RaisePropertyChanged(() => Columns);

        }
开发者ID:mparsin,项目名称:Elements,代码行数:58,代码来源:SearchListExtensions.cs

示例3: parseStringTest

        public void parseStringTest()
        {
            Condition_Accessor target = new Condition_Accessor(); // TODO: Initialize to an appropriate value
            ColumnCollection grid_columns = new ColumnCollection();
            grid_columns.Add(new TextColumn("Sloupec 1"));
            grid_columns.Add(new TextColumn("Sloupec 2"));
            grid_columns.Add(new NumberColumn("Sloupec 3"));
            grid_columns.Add(new NumberColumn("cislo"));

            grid_columns.Add(new TextColumn("Sloupec like"));

            Check(target, "[Sloupec 1] = 100", grid_columns, grid_columns[0], "100", Operators.equal);
            Check(target, "cislo > 56", grid_columns, grid_columns[3], "56", Operators.greater_than);
            Check(target, "cislo >= '56'", grid_columns, grid_columns[3], "56", Operators.greater_than | Operators.equal);
            Check(target, "[Sloupec 2] LIKE '160%'", grid_columns, grid_columns[1], "160%", Operators.like);
            Check(target, "[Sloupec 2] like '160%'", grid_columns, grid_columns[1], "160%", Operators.like);
            Check(target, "Sloupec 2 like '160%'", grid_columns, grid_columns[1], "160%", Operators.like);
            Check(target, "Sloupec 2 like 'neco = pokus'", grid_columns, grid_columns[1], "neco = pokus", Operators.like);
            Check(target, "Sloupec 1 REGeXp 'neco.*'", grid_columns, grid_columns[0], "neco.*", Operators.regexp);

            Check(target, "[Sloupec like] like '160%'", grid_columns, grid_columns[4], "160%", Operators.like);
        }
开发者ID:pyramida,项目名称:DunaGrid,代码行数:22,代码来源:ConditionTest.cs

示例4: GetColumnsFromDefaultLayout

        public void GetColumnsFromDefaultLayout(string processSystemName, Action<ColumnCollection> callback)
        {
            var filter = GetLayoutFilter(processSystemName);

            TheDynamicTypeManager.BeginGetList<ILayoutList<ILayoutInfo>>(Constants.LayoutProcessName, (o, r) =>
                {
                    if (r.Error != null)
                    {
                        return;
                    }

                    var defaultLayout = (ILayoutInfo)r.Object[0];

                    var layoutViewModel = new NewLayoutViewModel
                    {
                        Id = defaultLayout.Id,
                        AccountId = defaultLayout.AccountId,
                        LayoutString = defaultLayout.LayoutDefinition,
                        IsAdminLayout = defaultLayout.IsAdminLayout ?? false,
                        IsDefault = defaultLayout.IsDefault ?? false,
                        Name = defaultLayout.Name,
                    };

                    layoutViewModel.Parse(layoutViewModel.LayoutString);

                    var type = TheDynamicTypeManager.GetListType(processSystemName).BaseType.GetGenericArguments()[1];

                    var columnCollection = new ColumnCollection();

                    for (int i = 0; i < layoutViewModel.LayoutColumns.Count; i++)
                    {
                        var layoutColumn = layoutViewModel.LayoutColumns[i];
                        var property = type.GetProperty(layoutColumn.SystemName);

                        var column = new ColumnItem(null, null)
                        {
                            Header = layoutColumn.Header,
                            ColumnName = layoutColumn.SystemName,
                            Width = layoutColumn.Width.HasValue ? layoutColumn.Width.Value : 0,
                            Order = i,
                            Property = property
                        };

                        columnCollection.Add(column);
                    }

                    callback(columnCollection);

                }, filterExpression: filter.ToJSON(), pageSize: 1);
        }
开发者ID:mparsin,项目名称:Elements,代码行数:50,代码来源:SimpleLayoutBuilder.cs

示例5: GetColumns

        public ColumnCollection GetColumns()
        {
            ColumnCollection temp = new ColumnCollection();

            DataTable dt = (DataTable)data_source.DataSource;

            int i = 0;

            foreach (DataColumn dc in dt.Columns)
            {
                IColumn col = ColumnTypeDelegator.getByType(dc.DataType);
                col.HeadText = dc.ColumnName;
                col.Width = 100;
                col.DataSourceColumnIndex = i;
                temp.Add(col);
                i++;
            }

            return temp;
        }
开发者ID:pyramida,项目名称:DunaGrid,代码行数:20,代码来源:BindingSourceDataReader.cs

示例6: GetColumns

		/// <summary>
		/// Returns the column for this table only (not hierarchy)
		/// </summary>
		/// <returns></returns>
		public IEnumerable<Column> GetColumns()
		{
			try
			{
				var retval = new ColumnCollection(this.Root);
				foreach (Reference r in this.Columns)
				{
					retval.Add((Column)r.Object);
				}
				return retval.OrderBy(x => x.Name);
			}
			catch (Exception ex)
			{
				throw;
			}
		}
开发者ID:nHydrate,项目名称:nHydrate,代码行数:20,代码来源:TableComponent.cs

示例7: GetColumnNotInRelationships

 public IEnumerable<Column> GetColumnNotInRelationships()
 {
     try
     {
         var inRelations = this.GetColumnInRelationships();
         var retval = new ColumnCollection(this.Root);
         foreach (var c in this.GetColumns())
         {
             if (!inRelations.Contains(c))
                 retval.Add(c);
         }
         return retval.OrderBy(x => x.Name);
     }
     catch (Exception ex)
     {
         throw;
     }
 }
开发者ID:nHydrate,项目名称:nHydrate,代码行数:18,代码来源:Table.cs

示例8: GetColumnInRelationships

 public ColumnCollection GetColumnInRelationships()
 {
     var retval = new ColumnCollection(this.Root);
     foreach (var r in ((ModelRoot)this.Root).Database.Relations.ToList())
     {
         if (r.ParentTableRef.Object == this)
         {
             foreach (var cr in r.ColumnRelationships.ToList())
             {
                 var column = cr.ParentColumnRef.Object as Column;
                 if (!retval.Contains(column))
                     retval.Add(column);
             }
         }
         else if (r.ChildTableRef.Object == this)
         {
             foreach (var cr in r.ColumnRelationships.ToList())
             {
                 var column = cr.ChildColumnRef.Object as Column;
                 if (!retval.Contains(column))
                     retval.Add(column);
             }
         }
     }
     return retval;
 }
开发者ID:nHydrate,项目名称:nHydrate,代码行数:26,代码来源:Table.cs

示例9: GetColumnsNotInBase

        /// <summary>
        /// This gets all columns in this class NOT in a base class
        /// </summary>
        /// <returns></returns>
        public ColumnCollection GetColumnsNotInBase()
        {
            try
            {
                var nameList = new List<string>();
                var fullList = GetColumnsFullHierarchy(false);

                var currentList = new List<Column>();
                foreach (var c in this.GetColumns())
                    currentList.Add(c);

                var delList = new List<Column>();
                foreach (var c in currentList)
                {
                    if (fullList[c.Name] != null)
                    {
                        delList.Add(c);
                    }
                }

                foreach (var c in delList)
                {
                    currentList.Remove(c);
                }

                var retval = new ColumnCollection(this.Root);
                foreach (var c in currentList)
                    retval.Add(c);
                return retval;

            }
            catch (Exception ex)
            {
                throw;
            }
        }
开发者ID:nHydrate,项目名称:nHydrate,代码行数:40,代码来源:Table.cs

示例10: GetColumnsFullHierarchy

        /// <summary>
        /// This gets all columns from this and all base classes
        /// </summary>
        /// <returns></returns>
        public ColumnCollection GetColumnsFullHierarchy(bool includeCurrent)
        {
            try
            {
                var nameList = new List<string>();
                var retval = new ColumnCollection(this.Root);

                var t = this;
                if (!includeCurrent) t = t.ParentTable;
                while (t != null)
                {
                    foreach (var r in t.Columns.ToList())
                    {
                        var c = r.Object as Column;
                        if (!nameList.Contains(c.Name.ToLower()))
                        {
                            nameList.Add(c.Name.ToLower());
                            retval.Add(c);
                        }
                    }
                    t = t.ParentTable;
                }
                return retval;

            }
            catch (Exception ex)
            {
                throw;
            }
        }
开发者ID:nHydrate,项目名称:nHydrate,代码行数:34,代码来源:Table.cs

示例11: CollectFieldsFromModel

		protected static ColumnCollection CollectFieldsFromModel(ReportModel model){
			if (model == null) {
				throw new ArgumentNullException("model");
			}
			ColumnCollection col = new ColumnCollection();
			
			foreach (BaseSection section in model.SectionCollection){
				for (int i = 0;i < section.Items.Count ;i ++ ) {
					IReportItem item = section.Items[i];
					BaseDataItem baseItem = item as BaseDataItem;
					if (baseItem != null) {
						col.Add(new AbstractColumn(baseItem.ColumnName));
					}
				}
			}
			return col;
		}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:17,代码来源:ReportEngine.cs

示例12: AddDisplayListColumns

        /// <summary>
        /// Adds the display list columns.
        /// </summary>
        /// <param name="columns">The columns.</param>
        /// <param name="itemType">Type of the item.</param>
        /// <param name="owner">The owner.</param>
        public static void AddDisplayListColumns(this ColumnCollection columns, Type itemType, IPageableList owner)
        {
            if (itemType == null)
                return;

            if (columns == null)
                return;

            var columnOut = new ColumnCollection();

            var props = itemType.GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.FlattenHierarchy);
            foreach (var prop in props)
            {
                if (prop.Name.Equals("DLOrderId"))
                    continue;

                var display = (DisplayAttribute)(from d in prop.GetCustomAttributes(typeof(DisplayAttribute), false) select d).FirstOrDefault();
                if (display == null || string.IsNullOrEmpty(display.Name)) continue;

                var column = ColumnFactory.CreateColumn(owner, columnOut);
                column.Header = display.GetName();
                column.ColumnName = prop.Name;
                column.Property = prop;

                var orderId = display.GetOrder() ?? 0;

                column.Order = orderId;
                columnOut.Add(column);
            }

            foreach (var columnItem in columnOut.OrderBy(d => d.Order))
            {
                columns.Add(columnItem);
            }
        }
开发者ID:mparsin,项目名称:Elements,代码行数:41,代码来源:ColumnsExtensions.cs

示例13: GenerateColumnsFromItemsSourceFields

    public static void GenerateColumnsFromItemsSourceFields(
      ColumnCollection columns,
      IDictionary<Type, CellEditor> defaultCellEditors,
      Dictionary<string, FieldDescriptor> fields,
      bool autoCreateForeignKeyConfigurations )
    {
      DataGridControl dataGridControl = columns.DataGridControl;

      using( columns.DeferColumnAdditionMessages() )
      {
        foreach( FieldDescriptor field in fields.Values )
        {
          string fieldName = field.Name;
          ColumnBase column = columns[ fieldName ];
          Column dataColumn = column as Column;
          Type dataType = field.DataType;

          if( column == null )
          {
            dataColumn = ItemsSourceHelper.CreateColumnFromItemsSourceField(
              dataGridControl, defaultCellEditors, field, autoCreateForeignKeyConfigurations );

            if( dataColumn != null )
            {
              columns.Add( dataColumn );
              ItemsSourceHelper.ApplySettingsRepositoryToColumn( dataColumn );
            }
          }
          else if( dataColumn != null )
          {
            if( field.ReadOnly )
            {
              if( dataColumn.ReadLocalValue( Column.ReadOnlyProperty ) == DependencyProperty.UnsetValue )
              {
                dataColumn.ReadOnly = field.ReadOnly;
              }
            }

            if( field.OverrideReadOnlyForInsertion )
            {
              if( dataColumn.ReadLocalValue( ColumnBase.OverrideReadOnlyForInsertionProperty ) == DependencyProperty.UnsetValue )
              {
                dataColumn.OverrideReadOnlyForInsertion = field.OverrideReadOnlyForInsertion;
              }
            }

            if( dataColumn.ReadLocalValue( Column.TitleProperty ) == DependencyProperty.UnsetValue )
            {
              dataColumn.Title = field.DisplayName;
            }

            if( dataColumn.ReadLocalValue( Column.CellEditorProperty ) == DependencyProperty.UnsetValue )
            {
              CellEditor cellEditor = null;

              if( defaultCellEditors != null )
              {
                defaultCellEditors.TryGetValue( dataType, out cellEditor );
              }

              if( cellEditor == null )
              {
                object descriptionItemsSource = null;
                object configurationItemsSource = null;
                ForeignKeyConfiguration configuration = dataColumn.ForeignKeyConfiguration;

                if( field.ForeignKeyDescription != null )
                {
                  descriptionItemsSource = field.ForeignKeyDescription.ItemsSource;
                }

                if( configuration != null )
                {
                  configurationItemsSource = configuration.ItemsSource;

                  if( configurationItemsSource == null )
                  {
                    configurationItemsSource = dataColumn.ReadLocalValue( Column.ForeignKeyConfigurationProperty );
                  }
                }

                // A foreign key ItemsSource is set and we can auto-create configuration
                // OR
                // if the foreign key ItemsSource was found in the ForeignKeyConfiguration
                //
                // use the Default ForeignKey CellEditor.
                if( ( ( descriptionItemsSource != null ) && ( autoCreateForeignKeyConfigurations ) )
                    || ( configurationItemsSource != null ) )
                {
                  cellEditor = DefaultCellEditorSelector.ForeignKeyCellEditor;
                }
              }

              if( cellEditor == null )
              {
                cellEditor = DefaultCellEditorSelector.SelectCellEditor( dataType );
              }

              dataColumn.CellEditor = cellEditor;
            }
//.........这里部分代码省略.........
开发者ID:Torion,项目名称:WpfExToolkit,代码行数:101,代码来源:ItemsSourceHelper.cs

示例14: redimTable

		internal void redimTable(int cols, int rows, bool copy,
			int cpCol, int cpRow, bool cpInserted,
			int colsAffected, int rowsAffected, bool undo)
		{
			resetCoveredCells();
			hasHeaderRows = false;

			if (undo) flowChart.UndoManager.onRedimTable(this);

			// remove arrows attached to deleted rows
			if (!cpInserted && (rowsAffected != 0) && (rowsList != null))
			{
				ArrayList arrowsToRemove = new ArrayList();
				for (int i = cpRow; i < cpRow + rowsAffected && i < this.rowsCount; ++i)
				{
					Row r = (Row)this.rowsList[i];
					for (int k = 0; k < r.IncomingArrows.Count; ++k)
						arrowsToRemove.Add(r.IncomingArrows[k]);
					for (int k = 0; k < r.OutgoingArrows.Count; ++k)
						arrowsToRemove.Add(r.OutgoingArrows[k]);
				}
				for (int j = 0; j < arrowsToRemove.Count; ++j)
					flowChart.DeleteObject((ChartObject)arrowsToRemove[j]);
				arrowsToRemove.Clear();
			}

			if (undo) flowChart.UndoManager.onRedimArrowsDeleted(this);

			CellCollection oldData = cells;
			RowCollection oldRowsDsc = rowsList;
			ColumnCollection oldColsDsc = colsList;
			int oldCols = this.columnsCount;
			int oldRows = this.rowsCount;
			bool copyC, copyR;
			copyC = copyR = copy;

			// resize the table
			this.columnsCount = cols;
			this.rowsCount = rows;

			// resize the columns array
			colsList = new ColumnCollection();
			if (this.columnsCount > 0)
			{
				for (int c = 0; c < this.columnsCount; ++c)
				{
					Column col = new Column(this);
					col.width = columnWidth;
					colsList.Add(col);
				}
			}
			else
			{
				copyC = false;
			}

			// resize the rows array
			rowsList = new RowCollection();
			if (this.rowsCount > 0)
			{
				for (int rr = 0; rr < this.rowsCount; ++rr)
				{
					Row row = new Row(this);
					row.Height = rowHeight;
					rowsList.Add(row);
				}
			}
			else
			{
				copyR = false;
			}

			// resize the cells array
			cells = new CellCollection();
			if (this.columnsCount > 0 && this.rowsCount > 0)
			{
				for (int i = 0; i < this.columnsCount * this.rowsCount; ++i)
					cells.Add(new Cell(this));
			}
			else
			{
				copy = false;
			}

			// copy data from the old cells array to the new one
			if (copy && (cells != null) && (oldData != null))
			{
				for (int rr = 0; rr < this.rowsCount; ++rr)
				{
					for (int c = 0; c < this.columnsCount; ++c)
					{
						int cr = rr;
						int cc = c;
						bool cp = true;
						if (cpInserted)
						{
							if (c >= cpCol && c < cpCol + colsAffected) cp = false;
							if (rr >= cpRow && rr < cpRow + rowsAffected) cp = false;
							if (c >= cpCol + colsAffected) cc -= colsAffected;
							if (rr >= cpRow + rowsAffected) cr -= rowsAffected;
//.........这里部分代码省略.........
开发者ID:ChrisMoreton,项目名称:Test3,代码行数:101,代码来源:Table.cs

示例15: CollectSortColumns

		private ColumnCollection CollectSortColumns()
		{
			ColumnCollection cl = new ColumnCollection();
			if (this.nodeSorting.Nodes.Count > 0) {
				SortColumn sortColumn;
				AbstractColumn abstrCol;
			
				foreach (SortColumnNode sortNode in this.nodeSorting.Nodes) {
				abstrCol = this.reportModel.ReportSettings.AvailableFieldsCollection.Find(sortNode.Text);
					
					if (abstrCol != null) {
						sortColumn = new SortColumn (sortNode.FieldName,
						                     sortNode.SortDirection,
						                     abstrCol.DataType,true);
					} else {
						sortColumn = new SortColumn (sortNode.Text,
						                     sortNode.SortDirection,
						                     typeof(System.String),true);
					}
					cl.Add(sortColumn);
				}
			}
			return cl;
		}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:24,代码来源:ExplorerTree.cs


注:本文中的ColumnCollection.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。