-
-
Notifications
You must be signed in to change notification settings - Fork 58
Expand file tree
/
Copy pathCollectionView.Properties.cs
More file actions
138 lines (115 loc) · 4.26 KB
/
Copy pathCollectionView.Properties.cs
File metadata and controls
138 lines (115 loc) · 4.26 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
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 a value indicating whether sort descriptions should be ignored when
/// rebuilding the view. Set by <see cref="TableView"/> when hierarchical mode is active
/// so that per-level sorting is applied during flattening instead of globally.
/// </summary>
internal bool BypassSort { get; set; }
/// <summary>
/// Gets or sets a value indicating whether filter descriptions should be ignored when
/// rebuilding the view. Set by <see cref="TableView"/> when hierarchical mode is active
/// so that subtree-aware filtering is applied during hierarchy flattening instead of
/// the flat per-item filter used in normal mode.
/// </summary>
internal bool BypassFilter { get; set; }
/// <summary>
/// Gets or sets the source collection.
/// </summary>
public IEnumerable Source
{
get => _source;
set
{
if (_source == value) return;
DetachCollectionChangedHandlers(_source);
DetachPropertyChangedHandlers(_source);
_source = value;
AttachCollectionChangedHandlers(_source);
AttachPropertyChangedHandlers(_source);
CreateItemsCopy(_source);
HandleSourceChanged();
OnPropertyChanged();
}
}
/// <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 => _allowLiveShaping;
set
{
if (_allowLiveShaping == value) return;
_allowLiveShaping = value;
if (_allowLiveShaping)
AttachPropertyChangedHandlers(_source);
else
DetachPropertyChangedHandlers(_source);
}
}
}