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


C# DataGridContext.SetIsCurrentHelper方法代码示例

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


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

示例1: DataGridControl

    public DataGridControl()
    {
      m_selectionChangerManager = new SelectionManager( this );

      this.SetValue( DataGridControl.ParentDataGridControlPropertyKey, this );

      //set the FixedItem for the gridControl to NotSet, this is to prevent problems with nested DataGridControls
      DataGridControl.SetFixedItem( this, DataGridControl.NotSet );

      this.SetDetailConfigurations( new DetailConfigurationCollection( this, null ) );

      this.DetailConfigurations.CollectionChanged += this.OnDetailConfigurationsChanged;

      this.CommandBindings.Add( new CommandBinding( DataGridCommands.ExpandGroup, this.OnExpandGroupExecuted, this.OnExpandGroupCanExecute ) );

      this.CommandBindings.Add( new CommandBinding( DataGridCommands.CollapseGroup, this.OnCollapseGroupExecuted, this.OnCollapseGroupCanExecute ) );

      this.CommandBindings.Add( new CommandBinding( DataGridCommands.ToggleGroupExpansion, this.OnToggleGroupExecuted, this.OnToggleGroupCanExecute ) );

      this.CommandBindings.Add( new CommandBinding( ApplicationCommands.SelectAll, this.OnSelectAllExecuted, this.OnSelectAllCanExecute ) );

      this.CommandBindings.Add( new CommandBinding( DataGridCommands.ClearFilter, this.OnClearFilterExecuted ) );

      // We keep a references to be able to remove the CommandBindings when they are not required (feature disabled)
      m_refreshCommandBinding = new CommandBinding( DataGridCommands.Refresh, this.OnRefreshExecuted, this.OnRefreshCanExecute );
      this.CommandBindings.Add( m_refreshCommandBinding );

      // We keep a references to be able to remove the CommandBindings when they are not required (feature disabled)
      m_copyCommandBinding = new CommandBinding( ApplicationCommands.Copy, this.OnCopyExecuted, this.OnCopyCanExecute );
      this.CommandBindings.Add( m_copyCommandBinding );

      // The delete command is not enabled by default, so don't add it to CommandBindings
      m_deleteCommandBinding = new CommandBinding( ApplicationCommands.Delete, this.OnDeleteExecuted, this.OnDeleteCanExecute );

      DataGridContext dataGridContext = new DataGridContext( null, this, null, this.Items, null );
      m_customItemContainerGenerator = CustomItemContainerGenerator.CreateGenerator( this, this.Items, dataGridContext );
      m_customItemContainerGenerator.DetailsChanged += OnDetailsChanged;

      DataGridControl.SetDataGridContext( this, dataGridContext );
      m_localDataGridContext = dataGridContext;

      //so that at least one DataGridContext is always current
      dataGridContext.SetIsCurrentHelper( true );
      this.SetCurrentDataGridContextHelper( dataGridContext );

      this.SetValue( DataGridControl.ColumnsPropertyKey, dataGridContext.Columns );
      this.SetValue( DataGridControl.VisibleColumnsPropertyKey, dataGridContext.VisibleColumns );
      this.SetValue( DataGridControl.GroupLevelDescriptionsPropertyKey, dataGridContext.GroupLevelDescriptions );
      this.SetValue( DataGridControl.SelectedItemsPropertyKey, dataGridContext.SelectedItems );
      this.SetValue( DataGridControl.SelectedItemRangesPropertyKey, new SelectionItemRangeCollection( dataGridContext.SelectedItemsStore ) );
      this.SetValue( DataGridControl.SelectedCellRangesPropertyKey, new SelectionCellRangeCollection( dataGridContext.SelectedCellsStore ) );

      // Apparently, we don't need to unsubscribe from these event handlers. These event 
      // subscriptions do not "root" the grid and we observed no leak cause be these.
      // We did not investigate why that is and we should keep an eye on it.
      this.GroupStyle.CollectionChanged += new NotifyCollectionChangedEventHandler( GroupStyle_CollectionChanged );


      if( DesignerProperties.GetIsInDesignMode( this ) )
      {
        // Workaround for VS2008's know issue (the DataGrid's Template is not active).
        // TODO (case 117288): Remove when the issue will be corrected.
        this.ClipToBounds = true;
      }

      this.Loaded += new RoutedEventHandler( DataGridControl_Loaded );
      this.LayoutUpdated += new EventHandler( DataGridControl_LayoutUpdated );
    }
开发者ID:wangws556,项目名称:duoduo-chat,代码行数:68,代码来源:DataGridControl.cs


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