-
-
Notifications
You must be signed in to change notification settings - Fork 60
Expand file tree
/
Copy pathCollectionView.Properties.cs
More file actions
123 lines (102 loc) · 3.46 KB
/
Copy pathCollectionView.Properties.cs
File metadata and controls
123 lines (102 loc) · 3.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
using Microsoft.UI.Xaml.Data;
using System.Collections;
using System.Collections.Generic;
using Windows.Foundation.Collections;
using WinUI.TableView.Extensions;
namespace WinUI.TableView;
partial class CollectionView
{
/// <summary>
/// Gets or sets the source collection.
/// </summary>
public IEnumerable Source
{
get;
set
{
if (field == value) return;
DetachCollectionChangedHandlers(field);
DetachPropertyChangedHandlers(field);
field = value;
AttachCollectionChangedHandlers(field);
AttachPropertyChangedHandlers(field);
CreateItemsCopy(field);
HandleSourceChanged();
OnPropertyChanged();
}
} = new List<object>();
/// <summary>
/// Gets a value indicating whether this CollectionView can filter its items.
/// </summary>
public bool CanFilter => FilterDescriptions.Count > 0;
/// <summary>
/// Gets the collection of filter descriptions.
/// </summary>
public IList<FilterDescription> FilterDescriptions => _filterDescriptions;
/// <summary>
/// Gets the collection of sort descriptions.
/// </summary>
public IList<SortDescription> SortDescriptions => _sortDescriptions;
/// <summary>
/// Gets or sets the item at the specified index.
/// </summary>
/// <param name="index">The zero-based index of the item to get or set.</param>
/// <returns>The item at the specified index.</returns>
public object? this[int index]
{
get => _view[index];
set => _view[index] = value;
}
/// <summary>
/// Gets the collection groups.
/// </summary>
public IObservableVector<object?>? CollectionGroups { get; } = null;
/// <summary>
/// Gets or sets the current item in the view.
/// </summary>
public object? CurrentItem
{
get => CurrentPosition > -1 && CurrentPosition < _view.Count ? _view[CurrentPosition] : null!;
set => MoveCurrentTo(value);
}
/// <summary>
/// Gets the current position of the item in the view.
/// </summary>
public int CurrentPosition { get; private set; }
/// <summary>
/// Gets a value indicating whether there are more items to load.
/// </summary>
public bool HasMoreItems => (Source as ISupportIncrementalLoading)?.HasMoreItems ?? false;
/// <summary>
/// Gets a value indicating whether the current item is after the last item in the view.
/// </summary>
public bool IsCurrentAfterLast => CurrentPosition >= _view.Count;
/// <summary>
/// Gets a value indicating whether the current item is before the first item in the view.
/// </summary>
public bool IsCurrentBeforeFirst => CurrentPosition < 0;
/// <summary>
/// Gets the number of items in the view.
/// </summary>
public int Count => _view.Count;
/// <summary>
/// Gets a value indicating whether the collection is read-only.
/// </summary>
public bool IsReadOnly => Source == null || Source.IsReadOnly();
/// <summary>
/// Gets or sets a value indicating whether live shaping is enabled.
/// </summary>
public bool AllowLiveShaping
{
get;
set
{
if (field == value) return;
field = value;
if (field)
AttachPropertyChangedHandlers(Source);
else
DetachPropertyChangedHandlers(Source);
}
}
}