Files
PropertyGrid/Avalonia.PropertyGrid/Models/CategoryGroup.cs
T
Matthias Heil 37720f103b Refactor PropertyGrid UI, converters, and solution setup
- Improved PropertyGrid.axaml formatting and control styles; ensured spinner buttons are always visible and ColorPicker layouts are flexible; disabled horizontal scrolling in property list.
- Reformatted property editors and group/category display for clarity.
- Made all value converters sealed, added XML docs, and updated ConvertBack to throw NotImplementedException where unsupported.
- Enhanced search logic to use StringComparison.OrdinalIgnoreCase.
- Minor code style fixes (e.g., char literals for string checks).
- Removed default value assignment for _useProxy in AdvancedConfiguration.cs.
- Updated Program.cs in examples to use sealed Program classes.
- Added PropertyGrid.slnx to organize solution and projects.
2026-08-13 09:49:27 +02:00

59 lines
1.5 KiB
C#

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