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


C# DataGridContext.GetChildContexts方法代码示例

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


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

示例1: RecursiveSaveDataGridContextsState

    private void RecursiveSaveDataGridContextsState( DataGridContext dataGridContext )
    {
      SaveRestoreDataGridContextStateVisitor saveRestoreDataGridContextStateVisitor
        = new SaveRestoreDataGridContextStateVisitor( true, int.MaxValue, m_stopAtFirstCollapsedGroup );

      saveRestoreDataGridContextStateVisitor.SaveState( dataGridContext as IDataGridContextVisitable );

      m_dataGridContextsStateDictionary.Add( new WeakDataGridContextKey( dataGridContext ), saveRestoreDataGridContextStateVisitor );

      IEnumerable<DataGridContext> subDataGridContexts = dataGridContext.GetChildContexts();

      foreach( DataGridContext subDataGridContext in subDataGridContexts )
      {
        this.RecursiveSaveDataGridContextsState( subDataGridContext );
      }
    }
开发者ID:austinedeveloper,项目名称:WpfExtendedToolkit,代码行数:16,代码来源:SaveRestoreGlobalStateVisitor.cs

示例2: EnsureNodeTreeCreatedOnAllSubContext

    private void EnsureNodeTreeCreatedOnAllSubContext( DataGridContext context )
    {
      // context.GetChildContexts() do a EnsureNodeTreeCreated(), no need to do one before calling it

      foreach( var subContext in context.GetChildContexts() )
      {
        this.EnsureNodeTreeCreatedOnAllSubContext( subContext );
      }
    }
开发者ID:Torion,项目名称:WpfExToolkit,代码行数:9,代码来源:SelectionManager.cs

示例3: GetVisiblePositionsForContextDetailLevel

      // Parse all the expanded details recursively
      private void GetVisiblePositionsForContextDetailLevel( DataGridContext dataGridContext, int desiredDetailLevel, HashSet<int> exportedColumnPositions )
      {
        int dataGridContextDetailLevel = dataGridContext.DetailLevel;

        // The detail level is too deep, return immediately
        if( dataGridContextDetailLevel > desiredDetailLevel )
          return;

        // The desired detail level is reached get the exportedColumnPositions
        if( dataGridContextDetailLevel == desiredDetailLevel )
        {
          DataGridContext parentDataGridContext = dataGridContext.ParentDataGridContext;

          if( parentDataGridContext == null )
          {
            this.GetVisibleColumnsVisiblePositionForDataGridContext( dataGridContext, exportedColumnPositions );
          }
          else
          {
            foreach( DataGridContext childContext in parentDataGridContext.GetChildContexts() )
            {
              if( this.GetVisibleColumnsVisiblePositionForDataGridContext( childContext, exportedColumnPositions ) )
              {
                // All columns need to be exported, stop parsing child DataGridContexts
                break;
              }
            }
          }
        }
        else
        {
          // The detail level differs, parse the child contexts recursively
          foreach( DataGridContext childContext in dataGridContext.GetChildContexts() )
          {
            this.GetVisiblePositionsForContextDetailLevel( childContext, desiredDetailLevel, exportedColumnPositions );
          }
        }
      }
开发者ID:austinedeveloper,项目名称:WpfExtendedToolkit,代码行数:39,代码来源:ClipboardExporterBase.cs

示例4: GetDataGridContextFromDetailConfiguration

    private static DataGridContext GetDataGridContextFromDetailConfiguration(
    DetailConfiguration configuration,
    DataGridContext parentDataGridContext )
    {
      if( ( configuration == null ) || ( parentDataGridContext == null ) )
        return null;

      if( parentDataGridContext.SourceDetailConfiguration == configuration )
        return parentDataGridContext;

      foreach( DataGridContext childContext in parentDataGridContext.GetChildContexts() )
      {
        DataGridContext foundContext =
          HierarchicalGroupByControlNode.GetDataGridContextFromDetailConfiguration( configuration,
            childContext );

        if( foundContext != null )
          return foundContext;
      }

      return null;
    }
开发者ID:Torion,项目名称:WpfExToolkit,代码行数:22,代码来源:HierarchicalGroupByControlNode.cs

示例5: UpdateCurrentContextRecursive

    private DataGridContext UpdateCurrentContextRecursive(
      DataGridContext parentDataGridContext,
      DataGridContext oldCurrentDataGridContext,
      out object newCurrentItem )
    {
      if( parentDataGridContext == null )
      {
        newCurrentItem = null;
        return null;
      }

      foreach( DataGridContext childContext in parentDataGridContext.GetChildContexts() )
      {
        if( childContext.SourceDetailConfiguration == oldCurrentDataGridContext.SourceDetailConfiguration )
        {
          object oldCurrentItem = oldCurrentDataGridContext.CurrentItem;

          System.Data.DataView dataView =
            ItemsSourceHelper.TryGetDataViewFromDataGridContext( childContext );

          System.Data.DataRowView oldCurrentDataRowView = oldCurrentItem as System.Data.DataRowView;

          if( ( dataView != null ) && ( oldCurrentDataRowView != null ) )
          {
            System.Data.DataRow oldDataRow = oldCurrentDataRowView.Row;

            foreach( System.Data.DataRowView dataRowView in dataView )
            {
              if( dataRowView.Row == oldDataRow )
              {
                newCurrentItem = dataRowView;
                return childContext;
              }
            }
          }
          else
          {
            if( childContext.Items.Contains( oldCurrentItem ) )
            {
              newCurrentItem = oldCurrentItem;
              return childContext;
            }
          }
        }

        DataGridContext foundContext = this.UpdateCurrentContextRecursive( childContext, oldCurrentDataGridContext, out newCurrentItem );

        if( foundContext != null )
          return foundContext;
      }

      newCurrentItem = null;
      return null;
    }
开发者ID:wangws556,项目名称:duoduo-chat,代码行数:54,代码来源:DataGridControl.cs

示例6: ProcessVisit

    public void ProcessVisit(
      DataGridContext sourceContext,
      int minIndex,
      int maxIndex,
      IDataGridContextVisitor visitor,
      DataGridContextVisitorType visitorType,
      bool visitDetails,
      out bool visitWasStopped )
    {
      visitWasStopped = false;

      // This is used only for DataGridContextVisitorType.ItemsBlock
      int startSourceDataItemIndex = -1;
      int endSourceDataItemIndex = -1;

      if( minIndex < 0 )
      {
        DataGridException.ThrowSystemException( "The minimum index must be greater than or equal to zero.",
                                                typeof( ArgumentException ), sourceContext.DataGridControl.Name, "minIndex" );
      }

      if( ( visitorType & DataGridContextVisitorType.DataGridContext ) == DataGridContextVisitorType.DataGridContext )
      {
        visitor.Visit( sourceContext, ref visitWasStopped );

        if( visitWasStopped )
          return;
      }

      //Take a shortcut, if the visit is made only for contexts, and there is no child contexts
      //return right away.
      bool containsDetails = false;

      foreach( DataGridContext childContext in sourceContext.GetChildContexts() )
      {
        containsDetails = true;
        break;
      }

      bool processed = false;

      do
      {
        //resets the flag that indicates if the node was already processed
        processed = false;

        int itemCount = this.CurrentNode.ItemCount;

        //If the whole current node is below the minIndex, jump over it.
        if( ( this.Index + ( itemCount - 1 ) ) < minIndex )
        {
          processed = true;
        }

        //when the index to visit exceeds the range defined, exit the loop.
        if( this.Index > maxIndex )
          break;

        int minForNode = Math.Max( 0, minIndex - this.Index ); // this will give the base offset within the node where to start the visitating!
        int maxForNode = Math.Min( itemCount - 1, maxIndex - this.Index ); //this will five the max offset within this node to visit (protected against overlfow )

        if( !processed )
        {
          HeadersFootersGeneratorNode headersNode = this.CurrentNode as HeadersFootersGeneratorNode;

          if( headersNode != null )
          {
            bool isHeaderFooter = ( headersNode.Parent == null );

            //If the node is a Headers or Footers node AND the visitorType does not contain HeadersFooters
            if( ( isHeaderFooter ) && ( ( visitorType & DataGridContextVisitorType.HeadersFooters ) == DataGridContextVisitorType.HeadersFooters ) )
            {
              GeneratorNodeHelper.ProcessHeadersNodeVisit( headersNode, sourceContext, minForNode, maxForNode, visitor, ref visitWasStopped );
            }
            else if( ( !isHeaderFooter ) && ( ( visitorType & DataGridContextVisitorType.GroupHeadersFooters ) == DataGridContextVisitorType.GroupHeadersFooters ) )
            {
              GeneratorNodeHelper.ProcessHeadersNodeVisit( headersNode, sourceContext, minForNode, maxForNode, visitor, ref visitWasStopped );
            }

            processed = true;
          }
        }

        if( !processed )
        {
          ItemsGeneratorNode itemsNode = this.CurrentNode as ItemsGeneratorNode;

          if( itemsNode != null )
          {
            if( ( visitorType & DataGridContextVisitorType.ItemsBlock ) == DataGridContextVisitorType.ItemsBlock )
            {
              GeneratorNodeHelper.ProcessItemsNodeBlockVisit(
                itemsNode, sourceContext,
                minForNode, maxForNode,
                visitor, visitorType, visitDetails, containsDetails, m_sourceDataIndex,
                ref startSourceDataItemIndex, ref endSourceDataItemIndex, ref visitWasStopped );
            }
            else if( ( ( visitDetails ) && ( containsDetails ) )
              || ( ( visitorType & DataGridContextVisitorType.Items ) == DataGridContextVisitorType.Items ) )
            {
//.........这里部分代码省略.........
开发者ID:austinedeveloper,项目名称:WpfExtendedToolkit,代码行数:101,代码来源:GeneratorNodeHelper.cs

示例7: RecursiveRestoreDataGridContextsState

    private void RecursiveRestoreDataGridContextsState( DataGridContext dataGridContext )
    {
      WeakDataGridContextKey weakDataGridContextKey = new WeakDataGridContextKey( dataGridContext );

      SaveRestoreDataGridContextStateVisitor saveRestoreDataGridContextStateVisitor;

      if( m_dataGridContextsStateDictionary.TryGetValue( weakDataGridContextKey, out saveRestoreDataGridContextStateVisitor ) )
      {
        try
        {
          saveRestoreDataGridContextStateVisitor.RestoreState( dataGridContext as IDataGridContextVisitable );
        }
        finally
        {
          m_dataGridContextsStateDictionary.Remove( weakDataGridContextKey );
        }
      }

      IEnumerable<DataGridContext> subDataGridContexts = dataGridContext.GetChildContexts();
      foreach( DataGridContext subDataGridContext in subDataGridContexts )
      {
        this.RecursiveRestoreDataGridContextsState( subDataGridContext );
      }
    }
开发者ID:austinedeveloper,项目名称:WpfExtendedToolkit,代码行数:24,代码来源:SaveRestoreGlobalStateVisitor.cs


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