本文整理汇总了C#中CollectionView.MoveCurrentToPrevious方法的典型用法代码示例。如果您正苦于以下问题:C# CollectionView.MoveCurrentToPrevious方法的具体用法?C# CollectionView.MoveCurrentToPrevious怎么用?C# CollectionView.MoveCurrentToPrevious使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CollectionView
的用法示例。
在下文中一共展示了CollectionView.MoveCurrentToPrevious方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsCurrentBeforeFirst_Returns_True_When_Before_First
public void IsCurrentBeforeFirst_Returns_True_When_Before_First()
{
List<int> source = new List<int> { 1, 2 };
CollectionView target = new CollectionView(source);
target.MoveCurrentToPrevious();
Assert.IsTrue(target.IsCurrentBeforeFirst);
Assert.AreEqual(-1, target.CurrentPosition);
}
示例2: IsCurrentAfterLast
public void IsCurrentAfterLast ()
{
CollectionView c = new CollectionView (new object [] { 1, 2 });
Assert.IsFalse (c.IsCurrentAfterLast, "1");
Assert.IsFalse (c.IsCurrentBeforeFirst, "2");
c.MoveCurrentTo (1);
Assert.IsFalse (c.IsCurrentAfterLast, "3");
Assert.IsFalse (c.IsCurrentBeforeFirst, "4");
c.MoveCurrentTo (3);
Assert.IsFalse (c.IsCurrentAfterLast, "5");
Assert.IsTrue (c.IsCurrentBeforeFirst, "6");
c.MoveCurrentTo (1);
Assert.IsFalse (c.IsCurrentAfterLast, "7");
Assert.IsFalse (c.IsCurrentBeforeFirst, "8");
c.MoveCurrentToPrevious ();
Assert.IsFalse (c.IsCurrentAfterLast, "9");
Assert.IsTrue (c.IsCurrentBeforeFirst, "10");
c.MoveCurrentToLast ();
c.MoveCurrentToNext ();
Assert.IsTrue (c.IsCurrentAfterLast, "11");
Assert.IsFalse (c.IsCurrentBeforeFirst, "12");
c.MoveCurrentToFirst ();
Assert.IsFalse (c.IsCurrentAfterLast, "13");
Assert.IsFalse (c.IsCurrentBeforeFirst, "14");
c.MoveCurrentToPrevious ();
c.MoveCurrentToNext ();
Assert.IsFalse (c.IsCurrentAfterLast, "15");
Assert.IsFalse (c.IsCurrentBeforeFirst, "16");
c.MoveCurrentToLast ();
c.MoveCurrentToNext ();
c.MoveCurrentToPrevious ();
Assert.IsFalse (c.IsCurrentAfterLast, "17");
Assert.IsFalse (c.IsCurrentBeforeFirst, "18");
}
示例3: MoveCurrentToPrevious_Can_Be_Called_Before_First
public void MoveCurrentToPrevious_Can_Be_Called_Before_First()
{
List<int> source = new List<int> { 1, 2, 3 };
CollectionView target = new CollectionView(source);
Assert.IsFalse(target.MoveCurrentToPrevious());
Assert.AreEqual(-1, target.CurrentPosition);
Assert.IsFalse(target.MoveCurrentToPrevious());
Assert.AreEqual(-1, target.CurrentPosition);
}
示例4: MoveCurrentToPrevious
public void MoveCurrentToPrevious ()
{
CollectionView c = new CollectionView (new object [] { 1, 2 });
Assert.IsFalse (c.MoveCurrentToPrevious (), "1");
Assert.IsNull (c.CurrentItem, "2");
Assert.AreEqual (c.CurrentPosition, -1, "3");
Assert.IsFalse (c.MoveCurrentToPrevious (), "4");
Assert.IsNull (c.CurrentItem, "5");
Assert.AreEqual (c.CurrentPosition, -1, "6");
c = new CollectionView (new object [] { 1, 2 });
c.MoveCurrentTo (2);
Assert.AreEqual (c.CurrentItem, 2, "8");
Assert.AreEqual (c.CurrentPosition, 1, "9");
Assert.IsTrue (c.MoveCurrentToPrevious (), "10");
Assert.AreEqual (c.CurrentItem, 1, "11");
Assert.AreEqual (c.CurrentPosition, 0, "12");
Assert.IsFalse (c.MoveCurrentToPrevious (), "13");
Assert.IsNull (c.CurrentItem, "14");
Assert.AreEqual (c.CurrentPosition, -1, "15");
}