本文整理汇总了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 );
}