diff --git a/SukiUI.Demo/Features/ControlsLibrary/CollectionsView.axaml b/SukiUI.Demo/Features/ControlsLibrary/CollectionsView.axaml index 66c025143..2ce6407c5 100644 --- a/SukiUI.Demo/Features/ControlsLibrary/CollectionsView.axaml +++ b/SukiUI.Demo/Features/ControlsLibrary/CollectionsView.axaml @@ -72,15 +72,16 @@ MaxHeight="200" CanUserResizeColumns="{Binding IsDataGridColumnsResizable}" ItemsSource="{Binding DataGridContent}"> + + + - - - - + + + + diff --git a/SukiUI.Demo/Features/ControlsLibrary/CollectionsViewModel.cs b/SukiUI.Demo/Features/ControlsLibrary/CollectionsViewModel.cs index 97243ff19..2ca721fff 100644 --- a/SukiUI.Demo/Features/ControlsLibrary/CollectionsViewModel.cs +++ b/SukiUI.Demo/Features/ControlsLibrary/CollectionsViewModel.cs @@ -10,7 +10,7 @@ namespace SukiUI.Demo.Features.ControlsLibrary; public partial class CollectionsViewModel : DemoPageBase { public AvaloniaList SimpleContent { get; } = []; - public AvaloniaList DataGridContent { get; } = []; + public DataGridCollectionView DataGridContent { get; } public AvaloniaList TreeViewContent { get; } = []; [ObservableProperty] private string _selectedSimpleContent; [ObservableProperty] private bool _isDataGridColumnsResizable; @@ -18,7 +18,9 @@ public partial class CollectionsViewModel : DemoPageBase public CollectionsViewModel() : base("Collections", MaterialIconKind.ListBox) { SimpleContent.AddRange(Enumerable.Range(1, 50).Select(x => $"Option {x}")); - DataGridContent.AddRange(Enumerable.Range(1, 50).Select(x => new DataGridContentViewModel(x))); + DataGridContent = new DataGridCollectionView(Enumerable.Range(1, 50).Select(x => new DataGridContentViewModel(x))); + DataGridContent.GroupDescriptions.Add(new DataGridPathGroupDescription("Group")); + //DataGridContent.AddRange(Enumerable.Range(1, 50).Select(x => new DataGridContentViewModel(x))); SelectedSimpleContent = SimpleContent.First(); TreeViewContent.AddRange( Enumerable.Range(1, 10).Select(x => new Node($"Outer {x}", @@ -30,8 +32,9 @@ public CollectionsViewModel() : base("Collections", MaterialIconKind.ListBox) public partial class DataGridContentViewModel(int value) : ObservableObject { [ObservableProperty] private string _stringColumn = $"Content {value}"; - [ObservableProperty] private int _intColumn = value; + [ObservableProperty] [NotifyPropertyChangedFor(nameof(Group))] private int _intColumn = value; [ObservableProperty] private bool _boolColumn = Random.Shared.Next(0, 2) == 0; + public string Group => IntColumn % 2 == 0 ? "Even" : "Odd"; } public partial class Node(string value, IEnumerable? subNodes = null) : ObservableObject diff --git a/SukiUI/Theme/DataGridStyle.axaml b/SukiUI/Theme/DataGridStyle.axaml index 09d24c581..8b6540606 100644 --- a/SukiUI/Theme/DataGridStyle.axaml +++ b/SukiUI/Theme/DataGridStyle.axaml @@ -221,7 +221,7 @@