本文整理汇总了C#中System.Windows.Data.PagedCollectionView.MoveCurrentToLast方法的典型用法代码示例。如果您正苦于以下问题:C# PagedCollectionView.MoveCurrentToLast方法的具体用法?C# PagedCollectionView.MoveCurrentToLast怎么用?C# PagedCollectionView.MoveCurrentToLast使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Data.PagedCollectionView
的用法示例。
在下文中一共展示了PagedCollectionView.MoveCurrentToLast方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetItemsSourceAndChangePageSize
public void SetItemsSourceAndChangePageSize()
{
// Create the ItemsSource
List<string> strings = new List<string>() { "one", "two", "three", "four" };
PagedCollectionView pagedCollectionView = new PagedCollectionView(strings);
pagedCollectionView.MoveCurrentToLast();
// Create the DataGrid
bool isLoaded = false;
DataGrid dataGrid = new DataGrid();
dataGrid.Loaded += delegate { isLoaded = true; };
dataGrid.ItemsSource = pagedCollectionView;
TestPanel.Children.Add(dataGrid);
this.EnqueueConditional(delegate { return isLoaded; });
// Initially, the DG's selected item should be the last item
Assert.AreEqual(4, dataGrid.SlotCount, "Incorrect SlotCount after adding and removing items");
Assert.AreEqual(4, dataGrid.VisibleSlotCount, "Incorrect VisibleSlotCount after adding and removing items");
Assert.AreEqual(3, dataGrid.SelectedIndex, "SelectedIndex was not updated when collection changed");
Assert.AreEqual("four", dataGrid.SelectedItem, "SelectedItem was not updated when collection changed");
// Changing the PageSize should cause the current and selected item to change
pagedCollectionView.PageSize = 2;
this.EnqueueYieldThread();
this.EnqueueCallback(delegate
{
Assert.AreEqual(2, dataGrid.SlotCount, "Incorrect SlotCount after adding and removing items");
Assert.AreEqual(2, dataGrid.VisibleSlotCount, "Incorrect VisibleSlotCount after adding and removing items");
Assert.AreEqual(0, dataGrid.SelectedIndex, "SelectedIndex was not updated when collection changed");
Assert.AreEqual("one", dataGrid.SelectedItem, "SelectedItem was not updated when collection changed");
});
this.EnqueueTestComplete();
}