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


C# CollectionView.MoveCurrentTo方法代码示例

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


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

示例1: LogViewModel

        public LogViewModel()
        {
            MessagesLock = new Object();
            messages = new ObservableCollection<LogMessageModel>();

            BindingOperations.EnableCollectionSynchronization(messages, MessagesLock);
            //clearLog = new Command(new Action(() => messages.Clear()));

            LogLevel = new CollectionView(Enum.GetValues(typeof(LogMessageModel.LogLevel)));
            LogLevel.MoveCurrentTo(LogMessageModel.LogLevel.INFO);
        }
开发者ID:iejeecee,项目名称:mediaviewer,代码行数:11,代码来源:LogViewModel.cs

示例2: ButtonMappingViewModel

        public ButtonMappingViewModel(DsButtonProfile profile)
        {
            CurrentButtonProfile = profile;

            CurrentCommandTypeView = new CollectionView(AvailableCommandTypes);
            CurrentCommandTargetView = new CollectionView(AvailableKeys);

            CurrentCommandTypeView.MoveCurrentTo(AvailableCommandTypes.First());
            CurrentCommandTargetView.MoveCurrentTo(AvailableKeys.First());

            if (CurrentButtonProfile != null)
            {
                CurrentCommandTypeView.MoveCurrentTo(profile.MappingTarget.CommandType);
                CurrentCommandTargetView.MoveCurrentTo(profile.MappingTarget.CommandTarget);
            }
            else
            {
                CurrentButtonProfile = new DsButtonProfile();
            }

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

示例3: ButtonMappingEntryControl

        public ButtonMappingEntryControl()
        {
            ButtonProfile = new DsButtonProfile();

            InitializeComponent();

            CurrentCommandTypeView = new CollectionView(AvailableCommandTypes);
            CurrentCommandTargetView = new CollectionView(AvailableKeys);

            CurrentCommandTypeView.MoveCurrentTo(AvailableCommandTypes.First());
            CurrentCommandTargetView.MoveCurrentTo(AvailableKeys.First());

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

示例4: MoveCurrentTo

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

示例5: 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

示例6: MoveCurrentTo

		public void MoveCurrentTo ()
		{
			CollectionView c = new CollectionView (new object [] { 1, 2 });
			Assert.IsTrue (c.MoveCurrentTo (2), "1");
			Assert.AreEqual (c.CurrentItem, 2, "2");
			Assert.AreEqual (c.CurrentPosition, 1, "3");
			Assert.IsFalse (c.MoveCurrentTo (null), "4");
			Assert.IsNull (c.CurrentItem, "5");
			Assert.AreEqual (c.CurrentPosition, -1, "6");
			Assert.IsFalse (c.MoveCurrentTo (3), "7");
			Assert.IsNull (c.CurrentItem, "8");
			Assert.AreEqual (c.CurrentPosition, -1, "9");
			c = new CollectionView (new object [] { null, 1 });
			Assert.IsNull (c.CurrentItem, "10");
			Assert.AreEqual (c.CurrentPosition, 0, "11");
			Assert.IsTrue (c.MoveCurrentTo (1), "12");
			Assert.AreEqual (c.CurrentItem, 1, "13");
			Assert.AreEqual (c.CurrentPosition, 1, "14");
			Assert.IsTrue (c.MoveCurrentTo (null), "15");
			Assert.IsNull (c.CurrentItem, "16");
			Assert.AreEqual (c.CurrentPosition, 0, "17");
			c = new CollectionView (new object [] { -1, 1 });
			c.Filter = MoveCurrentToFilter;
			Assert.AreEqual (c.CurrentItem, -1, "18");
			Assert.AreEqual (c.CurrentPosition, 0, "19");
			Assert.IsTrue (c.MoveCurrentTo (-1), "20");
			Assert.AreEqual (c.CurrentItem, -1, "21");
			Assert.AreEqual (c.CurrentPosition, 0, "22");
		}
开发者ID:JianwenSun,项目名称:mono-soc-2007,代码行数:29,代码来源:CollectionViewTest.cs

示例7: 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");
		}
开发者ID:JianwenSun,项目名称:mono-soc-2007,代码行数:34,代码来源:CollectionViewTest.cs

示例8: 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");
		}
开发者ID:JianwenSun,项目名称:mono-soc-2007,代码行数:20,代码来源:CollectionViewTest.cs

示例9: MoveCurrentToFirst

		public void MoveCurrentToFirst ()
		{
			CollectionView c = new CollectionView (new object [] { 1, 2 });
			c.MoveCurrentTo (2);
			Assert.IsTrue (c.MoveCurrentToFirst (), "1");
			Assert.AreEqual (c.CurrentItem, 1, "2");
			Assert.AreEqual (c.CurrentPosition, 0, "3");
			c = new CollectionView (new object [] { });
			Assert.AreEqual (c.CurrentPosition, -1, "4");
			Assert.IsFalse (c.MoveCurrentToFirst (), "5");
			Assert.IsNull (c.CurrentItem, "6");
			// Why?
			Assert.AreEqual (c.CurrentPosition, 0, "7");
		}
开发者ID:JianwenSun,项目名称:mono-soc-2007,代码行数:14,代码来源:CollectionViewTest.cs


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