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


C# PagedCollectionView.MoveCurrentToPosition方法代码示例

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


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

示例1: EnsureCurrentIndexSyncedAfterCollectionViewMovesToAfterLast

        public void EnsureCurrentIndexSyncedAfterCollectionViewMovesToAfterLast()
        {
            DataFormApp_Standard dataFormApp = new DataFormApp_Standard();
            PagedCollectionView pcv = new PagedCollectionView(DataClassList.GetDataClassList(2, ListOperations.All));
            dataFormApp.dataForm.ItemsSource = pcv;

            this.EnqueueCallback(() =>
            {
                this.DataFormAppBase = dataFormApp;
            });

            this.AddToPanelAndWaitForLoad();

            this.EnqueueCallback(() =>
            {
                Assert.AreEqual(0, pcv.CurrentPosition);
                Assert.AreEqual(pcv[0], dataFormApp.dataForm.CurrentItem);
                this.ExpectCurrentItemChange();
                pcv.MoveCurrentToPosition(2);
            });

            this.WaitForCurrentItemChange();

            this.EnqueueCallback(() =>
            {
                Assert.AreEqual(2, pcv.CurrentPosition);
                Assert.AreEqual(2, dataFormApp.dataForm.CurrentIndex);
                Assert.IsNull(dataFormApp.dataForm.CurrentItem);
                this.ExpectCurrentItemChange();
                pcv.MoveCurrentToPosition(0);
            });

            this.WaitForCurrentItemChange();

            this.EnqueueCallback(() =>
            {
                this.ExpectCurrentItemChange();
                dataFormApp.dataForm.CurrentIndex = 2;
            });

            this.WaitForCurrentItemChange();

            this.EnqueueCallback(() =>
            {
                Assert.AreEqual(2, pcv.CurrentPosition);
                Assert.AreEqual(2, dataFormApp.dataForm.CurrentIndex);
                Assert.IsNull(dataFormApp.dataForm.CurrentItem);
            });

            this.EnqueueTestComplete();
        }
开发者ID:modulexcite,项目名称:SilverlightToolkit,代码行数:51,代码来源:DataFormTests_Miscellaneous.cs

示例2: MoveCurrencyToNullWhenAppending

        public void MoveCurrencyToNullWhenAppending()
        {
            DataFormApp_Fields dataFormApp = new DataFormApp_Fields();

            List<DataClassWithValidation> dataClassList =
                new List<DataClassWithValidation>()
                {
                    new DataClassWithValidation()
                    {
                        StringProperty = "string 1"
                    }
                };

            PagedCollectionView pcv = new PagedCollectionView(dataClassList);

            this.EnqueueCallback(() =>
            {
                dataFormApp.dataForm.ItemsSource = pcv;
                this.DataFormAppBase = dataFormApp;
            });

            this.AddToPanelAndWaitForLoad();

            this.EnqueueCallback(() =>
            {
                this.ExpectCurrentItemChange();
                dataFormApp.dataForm.AddNewItem();
            });

            this.WaitForCurrentItemChange();

            this.EnqueueCallback(() =>
            {
                Assert.AreEqual(2, pcv.Count);
                this.ExpectCurrentItemChange();
                pcv.MoveCurrentToPosition(-1);
            });

            this.WaitForCurrentItemChange();

            this.EnqueueCallback(() =>
            {
                Assert.AreEqual(1, pcv.Count);
            });

            this.EnqueueTestComplete();
        }
开发者ID:modulexcite,项目名称:SilverlightToolkit,代码行数:47,代码来源:DataFormTests_Miscellaneous.cs

示例3: EnsureCollectionViewAtBeforeFirstIsMovedToFirst

        public void EnsureCollectionViewAtBeforeFirstIsMovedToFirst()
        {
            DataFormApp_Standard dataFormApp = new DataFormApp_Standard();
            PagedCollectionView cv = new PagedCollectionView(DataClassList.GetDataClassList(2, ListOperations.All));
            cv.MoveCurrentToPosition(-1);
            dataFormApp.dataForm.ItemsSource = cv;

            this.EnqueueCallback(() =>
            {
                this.DataFormAppBase = dataFormApp;
            });

            this.AddToPanelAndWaitForLoad();

            this.EnqueueCallback(() =>
            {
                Assert.AreEqual(0, cv.CurrentPosition);
            });

            this.EnqueueTestComplete();
        }
开发者ID:modulexcite,项目名称:SilverlightToolkit,代码行数:21,代码来源:DataFormTests_Miscellaneous.cs

示例4: ItemsSource


//.........这里部分代码省略.........
                    Assert.AreEqual(0, control.CurrentColumnIndex, "The first cell should be current by default");
                    Assert.AreEqual(control.Columns[0], control.CurrentColumn, "The first cell should be current by default");

                    Assert.AreEqual(2, this._counter, "SelectionChanged should have been raised");
                    Assert.IsNotNull(this._selectionChangedEventArgs, "SelectionChanged should have been raised");
                    Assert.IsNotNull(this._selectionChangedEventArgs.AddedItems);
                    Assert.AreEqual(1, this._selectionChangedEventArgs.AddedItems.Count, "A single item should have been added");
                    Assert.AreEqual(data3[3], this._selectionChangedEventArgs.AddedItems[0], "A single item should have been added");
                    Assert.IsNotNull(this._selectionChangedEventArgs.RemovedItems);
                    Assert.AreEqual(1, this._selectionChangedEventArgs.RemovedItems.Count, "A single item should have been removed");
                    Assert.AreEqual(data2[1], this._selectionChangedEventArgs.RemovedItems[0], "A single item should have been removed");

                    control.ItemsSource = pcv1;
                });
                this.EnqueueYieldThread();

                this.EnqueueCallback(delegate
                {
                    Assert.AreEqual(pcv1, control.ItemsSource);
                    Assert.AreEqual(pcv1[0], control.SelectedItem, "First item was not selected when setting ItemsSource to an ICollectionView");
                    Assert.AreEqual(0, control.SelectedIndex, "First item was not selected when setting ItemsSource to an ICollectionView");
                    Assert.AreEqual(0, control.CurrentColumnIndex, "The first cell should be current by default");
                    Assert.AreEqual(control.Columns[0], control.CurrentColumn, "The first cell should be current by default");

                    Assert.AreEqual(3, this._counter, "SelectionChanged should have been raised");
                    Assert.IsNotNull(this._selectionChangedEventArgs, "SelectionChanged should have been raised");
                    Assert.IsNotNull(this._selectionChangedEventArgs.AddedItems);
                    Assert.AreEqual(1, this._selectionChangedEventArgs.AddedItems.Count, "A single item should have been added");
                    Assert.AreEqual(pcv1[0], this._selectionChangedEventArgs.AddedItems[0], "A single item should have been added");
                    Assert.IsNotNull(this._selectionChangedEventArgs.RemovedItems);
                    Assert.AreEqual(1, this._selectionChangedEventArgs.RemovedItems.Count, "A single item should have been removed");
                    Assert.AreEqual(data3[3], this._selectionChangedEventArgs.RemovedItems[0], "A single item should have been removed");

                    pcv2.MoveCurrentToPosition(1);
                    control.ItemsSource = pcv2;
                });
                this.EnqueueYieldThread();

                this.EnqueueCallback(delegate
                {
                    Assert.AreEqual(pcv2, control.ItemsSource);
                    Assert.AreEqual(pcv2[1], control.SelectedItem, "CollectionView.CurrentItem was not selected by default");
                    Assert.AreEqual(1, control.SelectedIndex, "CollectionView.CurrentItem was not selected by default");
                    Assert.AreEqual(0, control.CurrentColumnIndex, "The first cell should be current by default");
                    Assert.AreEqual(control.Columns[0], control.CurrentColumn, "The first cell should be current by default");

                    Assert.AreEqual(4, this._counter, "SelectionChanged should have been raised");
                    Assert.IsNotNull(this._selectionChangedEventArgs, "SelectionChanged should have been raised");
                    Assert.IsNotNull(this._selectionChangedEventArgs.AddedItems);
                    Assert.AreEqual(1, this._selectionChangedEventArgs.AddedItems.Count, "A single item should have been added");
                    Assert.AreEqual(pcv2[1], this._selectionChangedEventArgs.AddedItems[0], "A single item should have been added");
                    Assert.IsNotNull(this._selectionChangedEventArgs.RemovedItems);
                    Assert.AreEqual(1, this._selectionChangedEventArgs.RemovedItems.Count, "A single item should have been removed");
                    Assert.AreEqual(pcv1[0], this._selectionChangedEventArgs.RemovedItems[0], "A single item should have been removed");

                    pcv3.MoveCurrentToPosition(-1);
                    control.ItemsSource = pcv3;
                });
                this.EnqueueYieldThread();

                this.EnqueueCallback(delegate
                {
                    Assert.AreEqual(pcv3, control.ItemsSource);
                    Assert.IsNull(control.SelectedItem, "No items should be selected if CollectionView.CurrentItem is null");
                    Assert.AreEqual(-1, control.SelectedIndex, "No items should be selected if CollectionView.CurrentItem is null");
                    Assert.AreEqual(-1, control.CurrentColumnIndex, "There should be no current cell if CollectionView.CurrentItem is null");
开发者ID:kvervo,项目名称:HorizontalLoopingSelector,代码行数:67,代码来源:ItemsSource.cs


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