using System; using AsyncImageLoader; using Avalonia; using Avalonia.Controls; using Avalonia.Controls.Primitives; namespace StabilityMatrix.Avalonia.Controls.SelectableImageCard; public class SelectableImageButton : Button { public static readonly StyledProperty IsSelectedProperty = ToggleButton.IsCheckedProperty.AddOwner(); public static readonly StyledProperty SourceProperty = AdvancedImage.SourceProperty.AddOwner(); public static readonly StyledProperty ImageWidthProperty = AvaloniaProperty.Register< SelectableImageButton, double >("ImageWidth", 300); public static readonly StyledProperty ImageHeightProperty = AvaloniaProperty.Register< SelectableImageButton, double >("ImageHeight", 300); static SelectableImageButton() { AffectsRender(ImageWidthProperty, ImageHeightProperty); AffectsArrange(ImageWidthProperty, ImageHeightProperty); } public double ImageHeight { get => GetValue(ImageHeightProperty); set => SetValue(ImageHeightProperty, value); } public double ImageWidth { get => GetValue(ImageWidthProperty); set => SetValue(ImageWidthProperty, value); } public bool? IsSelected { get => GetValue(IsSelectedProperty); set => SetValue(IsSelectedProperty, value); } public string? Source { get => GetValue(SourceProperty); set => SetValue(SourceProperty, value); } }