本文整理汇总了C#中ColumnCollection类的典型用法代码示例。如果您正苦于以下问题:C# ColumnCollection类的具体用法?C# ColumnCollection怎么用?C# ColumnCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ColumnCollection类属于命名空间,在下文中一共展示了ColumnCollection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Table
/// <summary>
/// Construct a new <see cref="Table" />.
/// </summary>
/// <param name="tableName">
/// The name of the <see cref="Table" />.
/// </param>
/// <param name="headerAlignment">
/// The method to use to align the text in the table's header.
/// Defaults to <see cref="StringFormatting.LeftJustified" />.
/// </param>
public Table(string tableName=null, Alignment headerAlignment=null)
{
Title = tableName ?? string.Empty;
HeaderAlignment = headerAlignment ?? StringFormatting.LeftJustified;
Columns = new ColumnCollection();
Rows = new RowCollection(this);
}
示例2: 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;
}
示例3: TreeGrid1
public TreeGrid1()
{
InitializeComponent();
columns = new ColumnCollection(this);
realGrid.LostFocus += new EventHandler(realGrid_LostFocus);
realGrid.GotFocus += new EventHandler(realGrid_GotFocus);
}
示例4: PrimaryKeys
internal PrimaryKeys(ColumnCollection columns)
{
var pk = columns.Where(column => (column as ColumnSchema).PkContraintName != null);
this.keys = pk.Select(column => column.ColumnName).ToArray();
if (this.keys.Length != 0)
this.constraintName = pk.Select(column => (column as ColumnSchema).PkContraintName).First();
}
示例5: 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);
}
示例6: TableBase
public TableBase()
{
Table = new NewTablix
{
Name = Name ?? "Table_" + Guid.NewGuid().ToString().Replace("-", ""),
Style = new Style { Border = new Border { Style = "Solid" }.Create() }
};
Columns = new ColumnCollection();
Rows = new CornerRowCollection();
}
示例7: List
public ColumnCollection List(IEnumerable<IFilter> filters)
{
var columns = new ColumnCollection();
var rows = Discover(filters);
foreach (var row in rows)
columns.AddOrIgnore(row.Name);
return columns;
}
示例8: Type
public Type(string name)
{
if (name == null)
{
throw Error.SchemaRequirementViolation("Type", "Name");
}
this.name = name;
columns = new ColumnCollection();
associations = new AssociationCollection();
subTypes = new TypeCollection();
}
示例9: GridPanel
internal GridPanel(C1FlexGrid grid, CellType cellType, int rowHeight, int colWidth)
{
Grid = grid;
CellType = cellType;
_cells = new CellRangeDictionary();
ViewRange = CellRange.Empty;
Rows = new RowCollection(this, rowHeight);
Columns = new ColumnCollection(this, colWidth);
HorizontalAlignment = HorizontalAlignment.Left;
VerticalAlignment = VerticalAlignment.Top;
}
示例10: SetLayoutTest
public void SetLayoutTest()
{
#region Arrange
var layoutFieldViewModelFactory = new ExportFactory<LayoutFieldViewModel>(() => new Tuple<LayoutFieldViewModel, Action>(new LayoutFieldViewModel(), () => { }));
var field1Name = "BaseField1";
var field2Name = "BaseField2";
var field3Name = "Field1";
var field4Name = "Field2";
var field1Prefix = Constants.BaseInfoPropertyName;
var field2Prefix = string.Format("{0}.{0}.{0}", Constants.BaseInfoPropertyName);
string field3Prefix = null;
string field4Prefix = null;
var column1 = CreateColumnItem(field1Name, field1Prefix);
var column2 = CreateColumnItem(field2Name, field2Prefix);
var column3 = CreateColumnItem(field3Name, field3Prefix);
var column4 = CreateColumnItem(field4Name, field4Prefix);
var columns = new ColumnCollection() { column1, column2, column3, column4 };
var modelLayoutList = new List<string>()
{
GetFullyQualifiedName(field1Name, field1Prefix),
GetFullyQualifiedName(field2Name, field2Prefix),
GetFullyQualifiedName(field3Name, field3Prefix),
GetFullyQualifiedName(field4Name, field4Prefix)
};
var model = new SearchViewModel() { LayoutList = modelLayoutList, Columns = columns };
var vm = new LayoutViewModel() { Model = model, LayoutFieldViewModelFactory = layoutFieldViewModelFactory };
#endregion Arrange
//Act
SetupRadGridViewHelper(new RadGridView(), new[] { column2, column3 });
vm.SetLayout(new List<string>());
//Assert
Assert.AreEqual(vm.LayoutList.Count, 0);
//Assert.AreEqual(vm.LayoutList[0].ColumnSystemName, GetFullyQualifiedName(field2Name, field2Prefix));
//Assert.AreEqual(vm.LayoutList[1].ColumnSystemName, GetFullyQualifiedName(field3Name, field3Prefix));
////Act
//SetupRadGridViewHelper(new RadGridView(), new[] { column1, column4 });
//vm.SetLayout(new List<string>());
////Assert
//Assert.AreEqual(vm.LayoutList.Count, 2);
//Assert.AreEqual(vm.LayoutList[0].ColumnSystemName, GetFullyQualifiedName(field1Name, field1Prefix));
//Assert.AreEqual(vm.LayoutList[1].ColumnSystemName, GetFullyQualifiedName(field4Name, field4Prefix));
}
示例11: 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);
}
示例12: Table
public Table()
{
//ExpandedColumnCount = 1;
//ExpandedRowCount = 1;
FullColumns = 1;
FullRows = 1;
DefaultColumnWidth = 54.0;
DefaultRowHeight = 13.5;
Rows = new RowCollection();
Columns = new ColumnCollection();
}
示例13: AddColumns
/// <summary>
/// Adds the columns.
/// </summary>
/// <param name="columns">The columns.</param>
/// <param name="itemType">Type of the item.</param>
/// <param name="owner">The owner.</param>
/// <param name="prefix">The prefix.</param>
/// <param name="tableName">Name of the table.</param>
/// <param name="forFilter">if set to <c>true</c> [for filter].</param>
/// <param name="displayColumns">The display columns.</param>
/// <param name="columnOrder">The column order.</param>
public static void AddColumns(
this ColumnCollection columns,
Type itemType,
IRefreashable owner,
string prefix = null,
string tableName = null,
bool forFilter = false,
string[] displayColumns = null,
IList<string> columnOrder = null)
{
//aggregate own and parent's columns and return in default order
var columnsList = new ColumnCollection();
AddColumnsInternal(columnsList, itemType, owner, prefix, tableName, forFilter, displayColumns, columnOrder);
columns.AddRange(columnsList.OrderBy(c => c.DefaultOrder));
}
示例14: SynchronizeColumnSort
protected void SynchronizeColumnSort(
SynchronizationContext synchronizationContext,
SortDescriptionCollection sortDescriptions,
ColumnCollection columns )
{
ColumnSortCommand.ThrowIfNull( synchronizationContext, "synchronizationContext" );
ColumnSortCommand.ThrowIfNull( sortDescriptions, "sortDescriptions" );
ColumnSortCommand.ThrowIfNull( columns, "columns" );
if( !synchronizationContext.Own || !columns.Any() )
return;
this.SetResortCallback( sortDescriptions, columns );
int count = sortDescriptions.Count;
Dictionary<string, ColumnSortInfo> sortOrder = new Dictionary<string, ColumnSortInfo>( count );
for( int i = 0; i < count; i++ )
{
var sortDescription = sortDescriptions[ i ];
string propertyName = sortDescription.PropertyName;
if( sortOrder.ContainsKey( propertyName ) )
continue;
sortOrder.Add( propertyName, new ColumnSortInfo( i, sortDescription.Direction ) );
}
foreach( var column in columns )
{
ColumnSortInfo entry;
if( sortOrder.TryGetValue( column.FieldName, out entry ) )
{
column.SetSortIndex( entry.Index );
column.SetSortDirection( entry.Direction );
}
else
{
column.SetSortIndex( -1 );
column.SetSortDirection( SortDirection.None );
}
}
}
示例15: DataTableDpoClass
public DataTableDpoClass(DataTable table)
{
DatabaseName dname = new DatabaseName(ConnectionProviderManager.DefaultProvider, "MEM");
this.table = table;
this.tableName = new ClassTableName(new TableName(dname, TableName.dbo, table.TableName));
this._columns = new ColumnCollection(this);
foreach (DataColumn c in table.Columns)
{
this._columns.Add(new DtColumn(c));
}
this._identity = new IdentityKeys(this._columns);
this._computedColumns = new ComputedColumns(this._columns);
this._columns.UpdatePrimary(this.PrimaryKeys);
this._columns.UpdateForeign(this.ForeignKeys);
}