diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index 659da7a..0000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "name": "Debug", - "type": "comet", - "request": "launch", - "preLaunchTask": "comet: Build" - } - ] -} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json deleted file mode 100644 index acb55cc..0000000 --- a/.vscode/tasks.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "2.0.0", - "tasks": [ - { - "type": "comet", - "problemMatcher": [ - "$msCompile" - ], - "label": "comet: Build" - } - ] -} \ No newline at end of file diff --git a/Sample/VirtualListViewSample/Section.cs b/Sample/VirtualListViewSample/Section.cs index 27d550e..8ebe8e9 100644 --- a/Sample/VirtualListViewSample/Section.cs +++ b/Sample/VirtualListViewSample/Section.cs @@ -1,6 +1,24 @@ -namespace VirtualListViewSample; +using CommunityToolkit.Mvvm.ComponentModel; +using CommunityToolkit.Mvvm.Input; -public class Section : List +namespace VirtualListViewSample; + +public class Section : List { public string Title { get; set; } } + +public partial class SectionItem : ObservableObject +{ + [ObservableProperty] + string text; + + [ObservableProperty] + bool isDetailVisible; + + [RelayCommand] + void ToggleDetail() + { + IsDetailVisible = !IsDetailVisible; + } +} diff --git a/Sample/VirtualListViewSample/SectionedAdapter.cs b/Sample/VirtualListViewSample/SectionedAdapter.cs index 5d10e11..da36b2c 100644 --- a/Sample/VirtualListViewSample/SectionedAdapter.cs +++ b/Sample/VirtualListViewSample/SectionedAdapter.cs @@ -2,7 +2,7 @@ namespace VirtualListViewSample; -public class SectionedAdapter : VirtualListViewAdapterBase +public class SectionedAdapter : VirtualListViewAdapterBase { public SectionedAdapter(IList
items) : base() { @@ -20,7 +20,7 @@ public override int GetNumberOfSections() public override int GetNumberOfItemsInSection(int sectionIndex) => Items[sectionIndex].Count; - public override string GetItem(int sectionIndex, int itemIndex) + public override SectionItem GetItem(int sectionIndex, int itemIndex) => Items[sectionIndex][itemIndex]; public void AddItem(string sectionTitle, string itemName) @@ -33,7 +33,7 @@ public void AddItem(string sectionTitle, string itemName) Items.Add(section); } - section.Add(itemName); + section.Add(new SectionItem { Text = itemName }); InvalidateData(); } diff --git a/Sample/VirtualListViewSample/SectionedAdapterPage.xaml b/Sample/VirtualListViewSample/SectionedAdapterPage.xaml index f448b95..287a050 100644 --- a/Sample/VirtualListViewSample/SectionedAdapterPage.xaml +++ b/Sample/VirtualListViewSample/SectionedAdapterPage.xaml @@ -30,13 +30,21 @@ - + -