From d5399091b66508ef0738533b18ce089f41a204f0 Mon Sep 17 00:00:00 2001 From: Jumar Macato Date: Thu, 21 Mar 2019 21:33:17 +0800 Subject: [PATCH] Add prefixes and correct references from PageCollectionView to DataGridCollectionView. --- .../ControlCatalog/Pages/DataGridPage.xaml.cs | 6 ++-- .../Collections/DataGridCollectionView.cs | 34 +++++++++---------- .../DataGridDataConnection.cs | 10 +++--- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/samples/ControlCatalog/Pages/DataGridPage.xaml.cs b/samples/ControlCatalog/Pages/DataGridPage.xaml.cs index d37297d837..b8f63cf3e3 100644 --- a/samples/ControlCatalog/Pages/DataGridPage.xaml.cs +++ b/samples/ControlCatalog/Pages/DataGridPage.xaml.cs @@ -14,7 +14,7 @@ namespace ControlCatalog.Pages var dg1 = this.FindControl("dataGrid1"); dg1.IsReadOnly = true; - var collectionView1 = new CollectionViewBase(Countries.All); + var collectionView1 = new DataGridCollectionView(Countries.All); //collectionView.GroupDescriptions.Add(new PathGroupDescription("Region")); dg1.Items = collectionView1; @@ -22,7 +22,7 @@ namespace ControlCatalog.Pages var dg2 = this.FindControl("dataGridGrouping"); dg2.IsReadOnly = true; - var collectionView2 = new CollectionViewBase(Countries.All); + var collectionView2 = new DataGridCollectionView(Countries.All); collectionView2.GroupDescriptions.Add(new DataGridPathGroupDescription("Region")); dg2.Items = collectionView2; @@ -36,7 +36,7 @@ namespace ControlCatalog.Pages new Person { FirstName = "Elizabeth", LastName = "Thomas" }, new Person { FirstName = "Zack", LastName = "Ward" } }; - var collectionView3 = new CollectionViewBase(items); + var collectionView3 = new DataGridCollectionView(items); dg3.Items = collectionView3; diff --git a/src/Avalonia.Controls.DataGrid/Collections/DataGridCollectionView.cs b/src/Avalonia.Controls.DataGrid/Collections/DataGridCollectionView.cs index af13d89f2f..4b4203ba40 100644 --- a/src/Avalonia.Controls.DataGrid/Collections/DataGridCollectionView.cs +++ b/src/Avalonia.Controls.DataGrid/Collections/DataGridCollectionView.cs @@ -44,7 +44,7 @@ namespace Avalonia.Collections } /// Defines a method that enables a collection to provide a custom view for specialized sorting, filtering, grouping, and currency. - internal interface ICollectionViewFactory + internal interface IDataGridCollectionViewFactory { /// Returns a custom view for specialized sorting, filtering, grouping, and currency. /// A custom view for specialized sorting, filtering, grouping, and currency. @@ -52,9 +52,9 @@ namespace Avalonia.Collections } /// - /// PagedCollectionView view over an IEnumerable. + /// DataGrid-readable view over an IEnumerable. /// - public sealed class CollectionViewBase : IDataGridCollectionView, IDataGridEditableCollectionView, INotifyPropertyChanged //IPagedCollectionView, + public sealed class DataGridCollectionView : IDataGridCollectionView, IDataGridEditableCollectionView, INotifyPropertyChanged { /// /// Since there's nothing in the un-cancelable event args that is mutable, @@ -75,7 +75,7 @@ namespace Avalonia.Collections private int _cachedPageSize; /// - /// CultureInfo used in this PagedCollectionView + /// CultureInfo used in this DataGridCollectionView /// private CultureInfo _culture; @@ -198,18 +198,18 @@ namespace Avalonia.Collections /// Helper constructor that sets default values for isDataSorted and isDataInGroupOrder. /// /// The source for the collection - public CollectionViewBase(IEnumerable source) + public DataGridCollectionView(IEnumerable source) : this(source, false /*isDataSorted*/, false /*isDataInGroupOrder*/) { } /// - /// Initializes a new instance of the PagedCollectionView class. + /// Initializes a new instance of the DataGridCollectionView class. /// /// The source for the collection /// Determines whether the source is already sorted /// Whether the source is already in the correct order for grouping - public CollectionViewBase(IEnumerable source, bool isDataSorted, bool isDataInGroupOrder) + public DataGridCollectionView(IEnumerable source, bool isDataSorted, bool isDataInGroupOrder) { _sourceCollection = source ?? throw new ArgumentNullException(nameof(source)); @@ -1938,7 +1938,7 @@ namespace Avalonia.Collections } /// - /// Retrieve item at the given zero-based index in this PagedCollectionView, after the source collection + /// Retrieve item at the given zero-based index in this DataGridCollectionView, after the source collection /// is filtered, sorted, and paged. /// /// @@ -3890,7 +3890,7 @@ namespace Avalonia.Collections } /// - /// SortDescription was added/removed, refresh PagedCollectionView + /// SortDescription was added/removed, refresh DataGridCollectionView /// /// Sender that triggered this handler /// NotifyCollectionChangedEventArgs for this change @@ -3959,7 +3959,7 @@ namespace Avalonia.Collections private void VerifyRefreshNotDeferred() { // If the Refresh is being deferred to change filtering or sorting of the - // data by this PagedCollectionView, then PagedCollectionView will not reflect the correct + // data by this DataGridCollectionView, then DataGridCollectionView will not reflect the correct // state of the underlying data. if (IsRefreshDeferred) { @@ -4026,7 +4026,7 @@ namespace Avalonia.Collections } /// - /// Used to keep track of Defer calls on the PagedCollectionView, which + /// Used to keep track of Defer calls on the DataGridCollectionView, which /// will prevent the user from calling Refresh() on the view. In order /// to allow refreshes again, the user will have to call IDisposable.Dispose, /// to end the Defer operation. @@ -4036,13 +4036,13 @@ namespace Avalonia.Collections /// /// Private reference to the CollectionView that created this DeferHelper /// - private CollectionViewBase collectionView; + private DataGridCollectionView collectionView; /// /// Initializes a new instance of the DeferHelper class /// /// CollectionView that created this DeferHelper - public DeferHelper(CollectionViewBase collectionView) + public DeferHelper(DataGridCollectionView collectionView) { this.collectionView = collectionView; } @@ -4130,10 +4130,10 @@ namespace Avalonia.Collections /// /// Initializes a new instance of the NewItemAwareEnumerator class. /// - /// The PagedCollectionView we are creating the enumerator for + /// The DataGridCollectionView we are creating the enumerator for /// The baseEnumerator that we pass in /// The new item we are adding to the collection - public NewItemAwareEnumerator(CollectionViewBase collectionView, IEnumerator baseEnumerator, object newItem) + public NewItemAwareEnumerator(DataGridCollectionView collectionView, IEnumerator baseEnumerator, object newItem) { _collectionView = collectionView; _timestamp = collectionView.Timestamp; @@ -4204,7 +4204,7 @@ namespace Avalonia.Collections /// /// CollectionView that we are creating the enumerator for /// - private CollectionViewBase _collectionView; + private DataGridCollectionView _collectionView; /// /// The Base Enumerator that we are passing in @@ -4235,7 +4235,7 @@ namespace Avalonia.Collections { _comparers = MakeComparerArray(coll); } - public MergedComparer(CollectionViewBase collectionView) + public MergedComparer(DataGridCollectionView collectionView) : this(collectionView.SortDescriptions) { } diff --git a/src/Avalonia.Controls.DataGrid/DataGridDataConnection.cs b/src/Avalonia.Controls.DataGrid/DataGridDataConnection.cs index f5e0dbe3b3..e21ee3be37 100644 --- a/src/Avalonia.Controls.DataGrid/DataGridDataConnection.cs +++ b/src/Avalonia.Controls.DataGrid/DataGridDataConnection.cs @@ -87,7 +87,7 @@ namespace Avalonia.Controls return list.Count; } - if(DataSource is CollectionViewBase cv) + if(DataSource is DataGridCollectionView cv) { return cv.Count; } @@ -342,7 +342,7 @@ namespace Avalonia.Controls return (index < list.Count) ? list[index] : null; } - if (DataSource is CollectionViewBase collectionView) + if (DataSource is DataGridCollectionView collectionView) { return (index < collectionView.Count) ? collectionView.GetItemAt(index) : null; } @@ -413,7 +413,7 @@ namespace Avalonia.Controls return list.IndexOf(dataItem); } - if (DataSource is CollectionViewBase cv) + if (DataSource is DataGridCollectionView cv) { return cv.IndexOf(dataItem); } @@ -453,7 +453,7 @@ namespace Avalonia.Controls IDataGridCollectionView collectionView = null; - if (source is ICollectionViewFactory collectionViewFactory) + if (source is IDataGridCollectionViewFactory collectionViewFactory) { // If the source is a collection view factory, give it a chance to produce a custom collection view. collectionView = collectionViewFactory.CreateView(); @@ -462,7 +462,7 @@ namespace Avalonia.Controls if (collectionView == null) { // If we still do not have a collection view, default to a PagedCollectionView. - collectionView = new CollectionViewBase(source); + collectionView = new DataGridCollectionView(source); } return collectionView; }