using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; namespace Avalonia.PropertyGrid.Models; /// /// Represents a category group in the PropertyGrid /// public class CategoryGroup : INotifyPropertyChanged { private bool _isExpanded = true; /// /// Occurs when a property value changes. /// public event PropertyChangedEventHandler? PropertyChanged; /// /// The category name /// public string CategoryName { get; set; } = string.Empty; /// /// Properties in this category /// public ObservableCollection Properties { get; set; } = new(); /// /// Whether the category is expanded /// public bool IsExpanded { get => _isExpanded; set { if (_isExpanded != value) { _isExpanded = value; OnPropertyChanged(nameof(IsExpanded)); } } } /// /// Number of properties in this category /// public int PropertyCount => Properties.Count; protected virtual void OnPropertyChanged(string propertyName) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } }