本文整理汇总了C#中ColumnCollection.Contains方法的典型用法代码示例。如果您正苦于以下问题:C# ColumnCollection.Contains方法的具体用法?C# ColumnCollection.Contains怎么用?C# ColumnCollection.Contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ColumnCollection
的用法示例。
在下文中一共展示了ColumnCollection.Contains方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
示例2: IsColumn
private bool IsColumn(string t, ColumnCollection grid_columns, out string column_name)
{
bool zavorky = false;
//sloupce s nazvem o vice slovech
if (t[0] == '[' && t[t.Length - 1] == ']')
{
t = CutFirstAndLastLetter(t);
zavorky = true;
}
if (grid_columns.Contains(t))
{
column_name = t;
return true;
}
else
{
if (zavorky)
{
throw new ConditionException("Neexistujici sloupec '"+t+"'");
}
else
{
column_name = null;
}
return false;
}
}
示例3: ApplyColumnSort
private static void ApplyColumnSort( DataGridContext dataGridContext, SortDescriptionCollection sortDescriptions, ColumnCollection columns, ColumnBase column, SortDirection sortDirection )
{
if( column == null )
throw new ArgumentNullException( "column" );
Debug.Assert( ( dataGridContext != null ) || ( column.ParentDetailConfiguration != null ) );
if( ( dataGridContext == null ) && ( column.ParentDetailConfiguration == null ) )
throw new DataGridInternalException( "DataGridContext or ParentDetailConfiguration cannot be null." );
if( !columns.Contains( column ) )
throw new ArgumentException( "The specified column is not part of the DataGridContext.", "column" );
string fieldName = column.FieldName;
bool canSort = ( dataGridContext != null ) ? dataGridContext.Items.CanSort : true;
if( ( !string.IsNullOrEmpty( fieldName ) ) && ( canSort == true ) )
{
SortDescription existingSort;
int sortDescriptionIndex = sortDescriptions.Count;
for( int i = sortDescriptions.Count - 1; i >= 0; i-- )
{
existingSort = sortDescriptions[ i ];
if( existingSort.PropertyName == fieldName )
{
if( ( ( existingSort.Direction == ListSortDirection.Ascending ) && ( sortDirection == SortDirection.Ascending ) ) ||
( ( existingSort.Direction == ListSortDirection.Descending ) && ( sortDirection == SortDirection.Descending ) ) )
{
// Nothing to change!
sortDescriptionIndex = -1;
}
else
{
sortDescriptionIndex = i;
sortDescriptions.Remove( existingSort );
}
break;
}
}
int maxDescriptions = ( dataGridContext != null ) ? dataGridContext.MaxSortLevels
: column.ParentDetailConfiguration.MaxSortLevels;
if( ( maxDescriptions != -1 ) && ( sortDescriptions.Count >= maxDescriptions ) )
{
// Cannot insert sort description since it would go beyond the max sort description count.
sortDescriptionIndex = -1;
sortDirection = SortDirection.None;
}
if( ( sortDescriptionIndex > -1 ) && ( sortDirection != SortDirection.None ) )
{
SortDescription sortDescription = new SortDescription( fieldName,
( sortDirection == SortDirection.Ascending ) ? ListSortDirection.Ascending : ListSortDirection.Descending );
sortDescriptions.Insert( sortDescriptionIndex, sortDescription );
column.SetSortIndex( sortDescriptionIndex );
column.SetSortDirection( sortDirection );
}
SortingHelper.SynchronizeSortIndexes( sortDescriptions, columns );
}
}