當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。