using System.ComponentModel; using System.Windows.Input; using Avalonia; using Avalonia.Controls; using Avalonia.Controls.Templates; using Avalonia.Data; using Avalonia.Metadata; namespace DataBoxControl; public abstract class DataBoxColumn : AvaloniaObject { public static readonly StyledProperty CellTemplateProperty = AvaloniaProperty.Register(nameof(CellTemplate)); public static readonly StyledProperty HeaderProperty = AvaloniaProperty.Register(nameof(Header)); public static readonly StyledProperty ColumnNameProperty = AvaloniaProperty.Register(nameof(ColumnName), ""); public static readonly StyledProperty InitialWidthProperty = AvaloniaProperty.Register(nameof(InitialWidth), 50); public static readonly StyledProperty MinWidthProperty = AvaloniaProperty.Register(nameof(MinWidth), 22); public static readonly StyledProperty MaxWidthProperty = AvaloniaProperty.Register(nameof(MaxWidth), int.MaxValue); public static readonly StyledProperty CanUserSortProperty = AvaloniaProperty.Register(nameof(CanUserSort), true); public static readonly StyledProperty CanUserResizeProperty = AvaloniaProperty.Register(nameof(CanUserResize)); public static readonly StyledProperty CanUserReorderProperty = AvaloniaProperty.Register(nameof(CanUserReorder)); internal static readonly StyledProperty MeasureWidthProperty = AvaloniaProperty.Register(nameof(MeasureWidth), double.NaN); [Content] public IDataTemplate? CellTemplate { get => GetValue(CellTemplateProperty); set => SetValue(CellTemplateProperty, value); } public object? Header { get => GetValue(HeaderProperty); set => SetValue(HeaderProperty, value); } public int InitialWidth { get => GetValue(InitialWidthProperty); set => SetValue(InitialWidthProperty, value); } public int MinWidth { get => GetValue(MinWidthProperty); set => SetValue(MinWidthProperty, value); } public int MaxWidth { get => GetValue(MaxWidthProperty); set => SetValue(MaxWidthProperty, value); } public bool CanUserSort { get => GetValue(CanUserSortProperty); set => SetValue(CanUserSortProperty, value); } public bool CanUserResize { get => GetValue(CanUserSortProperty); set => SetValue(CanUserSortProperty, value); } public bool CanUserReorder { get => GetValue(CanUserSortProperty); set => SetValue(CanUserSortProperty, value); } public string ColumnName { get => GetValue(ColumnNameProperty); set => SetValue(ColumnNameProperty, value); } internal double MeasureWidth { get => GetValue(MeasureWidthProperty); set => SetValue(MeasureWidthProperty, value); } }