本文整理汇总了C#中DataGrid.CollapseRowGroup方法的典型用法代码示例。如果您正苦于以下问题:C# DataGrid.CollapseRowGroup方法的具体用法?C# DataGrid.CollapseRowGroup怎么用?C# DataGrid.CollapseRowGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataGrid
的用法示例。
在下文中一共展示了DataGrid.CollapseRowGroup方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DataGridGroupItem_IGridProvider
public void DataGridGroupItem_IGridProvider()
{
PagedCollectionView customers = CreateGroupedCustomerCollectionView();
DataGrid dataGrid = new DataGrid();
Assert.IsNotNull(dataGrid);
isLoaded = false;
dataGrid.Width = 350;
dataGrid.Height = 250;
dataGrid.Loaded += new RoutedEventHandler(dataGrid_Loaded);
dataGrid.AutoGenerateColumns = true;
dataGrid.ItemsSource = customers;
TestPeer testPeer = new TestPeer(dataGrid);
Assert.IsNotNull(testPeer);
TestPanel.Children.Add(dataGrid);
EnqueueConditional(delegate { return isLoaded; });
this.EnqueueYieldThread();
IGridProvider gridProvider = null;
IRawElementProviderSimple item = null;
EnqueueCallback(delegate
{
CollectionViewGroup group = customers.Groups[1] as CollectionViewGroup;
Assert.IsNotNull(group, "PagedCollectionView did not return CollectionViewGroup");
AutomationPeer peer = new DataGridGroupItemAutomationPeer(group, dataGrid);
Assert.IsNotNull(peer);
gridProvider = peer.GetPattern(PatternInterface.Grid) as IGridProvider;
Assert.IsNotNull(gridProvider);
Assert.AreEqual(7, gridProvider.RowCount, "Incorrect RowCount value");
Assert.AreEqual(dataGrid.Columns.Count, gridProvider.ColumnCount, "Incorrect ColumnCount value");
item = gridProvider.GetItem(5, 2);
Assert.IsNotNull(item, "GetItem returned null for valid cell");
AutomationPeer itemPeer = testPeer.GetPeerFromProvider(item);
Assert.AreEqual(typeof(DataGridCell).Name, itemPeer.GetClassName(), "GetItem did not return DataGridCell");
item = gridProvider.GetItem(100, 100);
Assert.IsNull(item, "GetItem returned object for invalid cell");
});
this.EnqueueYieldThread();
this.EnqueueCallback(delegate
{
// Collapse the group and check that GetItem still works
dataGrid.CollapseRowGroup(customers.Groups[1] as CollectionViewGroup, true);
});
this.EnqueueYieldThread();
this.EnqueueCallback(delegate
{
Assert.IsNotNull(gridProvider);
item = gridProvider.GetItem(5, 2);
Assert.IsNotNull(item, "GetItem returned null for valid cell");
AutomationPeer itemPeer = testPeer.GetPeerFromProvider(item);
Assert.AreEqual(typeof(DataGridCell).Name, itemPeer.GetClassName(), "GetItem did not return DataGridCell");
});
EnqueueTestComplete();
}