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


C# ColumnCollection.Contains方法代码示例

本文整理汇总了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;
 }
开发者ID:nHydrate,项目名称:nHydrate,代码行数:26,代码来源:Table.cs

示例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;
            }
        }
开发者ID:pyramida,项目名称:DunaGrid,代码行数:29,代码来源:Condition.cs

示例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 );
      }
    }
开发者ID:austinedeveloper,项目名称:WpfExtendedToolkit,代码行数:67,代码来源:SortingHelper.cs


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