-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainPage.xaml.cs
54 lines (48 loc) · 1.91 KB
/
MainPage.xaml.cs
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
using System.Collections.ObjectModel;
using Telerik.Maui.Controls.Data;
namespace CollectionViewFilterIssue
{
public partial class MainPage : ContentPage
{
public ObservableCollection<MenuItem> MenuItems { get; private set; } = [];
private MenuItem item1;
private MenuItem item2;
private MenuItem item3;
private MenuItem item4;
private MenuItem item5;
private MenuItem item6;
private MenuItem item7;
public MainPage()
{
InitializeComponent();
this.BindingContext = this;
this.listView.FilterDescriptors.Add(new BooleanFilterDescriptor { PropertyName = nameof(MenuItem.Visible), Value = true });
item1 = new MenuItem() { Title = "Item 1", Visible = true, Index = 0 };
item2 = new MenuItem() { Title = "Item 2", Visible = true, Index = 1 };
item3 = new MenuItem() { Title = "Item 3", Visible = true, Index = 2 };
item4 = new MenuItem() { Title = "Item 4", Visible = true, Index = 3 };
item5 = new MenuItem() { Title = "Item 5", Visible = true, Index = 4 };
item6 = new MenuItem() { Title = "Item 6", Visible = true, Index = 5 };
item7 = new MenuItem() { Title = "Item 7", Visible = true, Index = 6 };
MenuItems.Add(item1);
MenuItems.Add(item2);
MenuItems.Add(item3);
MenuItems.Add(item4);
MenuItems.Add(item5);
MenuItems.Add(item6);
MenuItems.Add(item7);
}
private void OnCounterClicked(object sender, EventArgs e)
{
item5.Visible = false;
item6.Visible = false;
item7.Visible = false;
}
private void BtnShowItems_Clicked(object sender, EventArgs e)
{
item5.Visible = true;
item6.Visible = true;
item7.Visible = true;
}
}
}