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


C# CollectionView.MoveCurrentToPosition方法代码示例

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


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

示例1: UserControl_Loaded

        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            DependencyPropertyDescriptor
                .FromProperty(ButtonProfileProperty, typeof (ButtonMappingEntryControl))
                .AddValueChanged(this, (s, args) =>
                {
                    if (ButtonProfile == null) return;

                    CurrentCommandTypeView = new CollectionView(AvailableCommandTypes);
                    CurrentCommandTypeView.MoveCurrentToPosition((int) ButtonProfile.MappingTarget.CommandType);

                    switch (ButtonProfile.MappingTarget.CommandType)
                    {
                        case CommandType.GamepadButton:
                            CurrentCommandTargetView = new CollectionView(AvailableGamepadButtons);
                            CurrentCommandTargetView.MoveCurrentTo(ButtonProfile.MappingTarget.CommandTarget);
                            break;
                        case CommandType.Keystrokes:
                            CurrentCommandTargetView = new CollectionView(AvailableKeys);
                            CurrentCommandTargetView.MoveCurrentTo(
                                AvailableKeys.FirstOrDefault(
                                    k => k == ToVirtualKeyCode(ButtonProfile.MappingTarget.CommandTarget)));
                            break;
                            // TODO: implement!
                        case CommandType.MouseButtons:
                            CurrentCommandTargetView = new CollectionView(AvailableMouseButtons);
                            break;
                    }

                    CurrentCommandTypeView.CurrentChanged += CurrentCommandTypeOnCurrentChanged;
                    CurrentCommandTargetView.CurrentChanged += CurrentCommandTargetOnCurrentChanged;
                });
        }
开发者ID:CheesyKek,项目名称:ScpToolkit,代码行数:33,代码来源:ButtonMappingEntryControl.xaml.cs

示例2: MoveCurrentToPosition

 private void MoveCurrentToPosition(CollectionView cv, int position)
 {
     if (cv != null && IsSynchronizedWithCurrentItemInternal)
     {
         cv.MoveCurrentToPosition(position);
     }
 }
开发者ID:kasicass,项目名称:kasicass,代码行数:7,代码来源:RibbonGallery.cs

示例3: MoveCurrentToPosition_Throws_Exception_For_Past_End_Index

        public void MoveCurrentToPosition_Throws_Exception_For_Past_End_Index()
        {
            List<int> source = new List<int> { 1, 2, 3 };
            CollectionView target = new CollectionView(source);

            target.MoveCurrentToPosition(4);
        }
开发者ID:modulexcite,项目名称:Avalonia,代码行数:7,代码来源:CollectionViewTests.cs

示例4: CurrentChanged_Should_Be_Raised_Even_If_Position_Doesnt_Change

        public void CurrentChanged_Should_Be_Raised_Even_If_Position_Doesnt_Change()
        {
            List<int> source = new List<int> { 1, 2, 3 };
            CollectionView target = new CollectionView(source);
            bool eventRaised = false;

            target.CurrentChanged += (s, e) => eventRaised = true;
            target.MoveCurrentToPosition(0);

            Assert.IsTrue(eventRaised);
        }
开发者ID:modulexcite,项目名称:Avalonia,代码行数:11,代码来源:CollectionViewTests.cs

示例5: MoveCurrentToPosition_Returns_False_For_After_End_Index

        public void MoveCurrentToPosition_Returns_False_For_After_End_Index()
        {
            List<int> source = new List<int> { 1, 2, 3 };
            CollectionView target = new CollectionView(source);

            Assert.IsFalse(target.MoveCurrentToPosition(3));
            Assert.IsNull(target.CurrentItem);
            Assert.AreEqual(3, target.CurrentPosition);
            Assert.IsFalse(target.IsCurrentBeforeFirst);
            Assert.IsTrue(target.IsCurrentAfterLast);
        }
开发者ID:modulexcite,项目名称:Avalonia,代码行数:11,代码来源:CollectionViewTests.cs

示例6: MoveCurrentToPosition_Minus_1_Can_Be_Cancelled

        public void MoveCurrentToPosition_Minus_1_Can_Be_Cancelled()
        {
            List<int> source = new List<int> { 1, 2, 3 };
            CollectionView target = new CollectionView(source);

            target.CurrentChanging += (s, e) => e.Cancel = true;

            Assert.IsTrue(target.MoveCurrentToPosition(-1));
            Assert.AreEqual(1, target.CurrentItem);
            Assert.AreEqual(0, target.CurrentPosition);
            Assert.IsFalse(target.IsCurrentBeforeFirst);
        }
开发者ID:modulexcite,项目名称:Avalonia,代码行数:12,代码来源:CollectionViewTests.cs

示例7: MoveCurrentToPosition_Returns_True_When_Item_Available

        public void MoveCurrentToPosition_Returns_True_When_Item_Available()
        {
            List<int> source = new List<int> { 1, 2, 3 };
            CollectionView target = new CollectionView(source);

            Assert.IsTrue(target.MoveCurrentToPosition(1));
            Assert.AreEqual(2, target.CurrentItem);
            Assert.AreEqual(1, target.CurrentPosition);
        }
开发者ID:modulexcite,项目名称:Avalonia,代码行数:9,代码来源:CollectionViewTests.cs

示例8: MoveCurrentToPosition_Returns_False_For_Empty_Collection

        public void MoveCurrentToPosition_Returns_False_For_Empty_Collection()
        {
            List<int> source = new List<int>();
            CollectionView target = new CollectionView(source);

            Assert.IsFalse(target.MoveCurrentToPosition(0));
            Assert.IsNull(target.CurrentItem);
            Assert.AreEqual(-1, target.CurrentPosition);
        }
开发者ID:modulexcite,项目名称:Avalonia,代码行数:9,代码来源:CollectionViewTests.cs

示例9: MoveCurrentToPosition

		public void MoveCurrentToPosition ()
		{
			CollectionView c = new CollectionView (new object [] { 1, 2 });
			Assert.IsTrue (c.MoveCurrentToPosition (1), "1");
			Assert.AreEqual (c.CurrentItem, 2, "2");
			Assert.AreEqual (c.CurrentPosition, 1, "3");
			Assert.IsFalse (c.MoveCurrentToPosition (2), "4");
			Assert.AreEqual (c.CurrentItem, null, "5");
			Assert.AreEqual (c.CurrentPosition, 2, "6");
			try {
				c.MoveCurrentToPosition (3);
				Assert.Fail ("7");
			} catch (ArgumentOutOfRangeException ex) {
				Assert.AreEqual (ex.ParamName, "position", "8");
			}
			Assert.AreEqual (c.CurrentItem, null, "9");
			Assert.AreEqual (c.CurrentPosition, 2, "10");

			c = new CollectionView (new object [] { 1, 2 });
			try {
				c.MoveCurrentToPosition (3);
				Assert.Fail ("11");
			} catch (ArgumentOutOfRangeException ex) {
				Assert.AreEqual (ex.ParamName, "position", "12");
			}
		}
开发者ID:JianwenSun,项目名称:mono-soc-2007,代码行数:26,代码来源:CollectionViewTest.cs


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