ListViewButton.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. using Avalonia;
  2. using Avalonia.Controls;
  3. using Avalonia.Controls.Primitives;
  4. using Avalonia.Markup.Xaml;
  5. using Avalonia.Media;
  6. using System.Windows.Input;
  7. namespace InABox.Avalonia.Components;
  8. public partial class ListViewButton : TemplatedControl
  9. {
  10. public static readonly StyledProperty<IImage?> ImageProperty =
  11. AvaloniaProperty.Register<ListViewButton, IImage?>(nameof(Image), null);
  12. public static readonly StyledProperty<string> TitleProperty =
  13. AvaloniaProperty.Register<ListViewButton, string>(nameof(Title), "");
  14. public static readonly StyledProperty<string> DescriptionProperty =
  15. AvaloniaProperty.Register<ListViewButton, string>(nameof(Description), "");
  16. public static readonly StyledProperty<string> AlertProperty =
  17. AvaloniaProperty.Register<ListViewButton, string>(nameof(Alert), "");
  18. public IImage? Image
  19. {
  20. get => GetValue(ImageProperty);
  21. set => SetValue(ImageProperty, value);
  22. }
  23. public string Title
  24. {
  25. get => GetValue(TitleProperty);
  26. set => SetValue(TitleProperty, value);
  27. }
  28. public string Description
  29. {
  30. get => GetValue(DescriptionProperty);
  31. set => SetValue(DescriptionProperty, value);
  32. }
  33. public string Alert
  34. {
  35. get => GetValue(AlertProperty);
  36. set => SetValue(AlertProperty, value);
  37. }
  38. public static readonly StyledProperty<object?> CommandParameterProperty =
  39. AvaloniaProperty.Register<ListViewButton, object?>(nameof(CommandParameter), null);
  40. public object? CommandParameter
  41. {
  42. get => GetValue(CommandParameterProperty);
  43. set => SetValue(CommandParameterProperty, value);
  44. }
  45. public static readonly StyledProperty<ICommand?> CommandProperty =
  46. AvaloniaProperty.Register<ListViewButton, ICommand?>(nameof(Command), null);
  47. public ICommand? Command
  48. {
  49. get => GetValue(CommandProperty);
  50. set => SetValue(CommandProperty, value);
  51. }
  52. }