DynamicImageColumn.cs 728 B

1234567891011121314151617181920212223242526272829
  1. using System.Windows.Media.Imaging;
  2. using InABox.Core;
  3. namespace InABox.DynamicGrid;
  4. public class DynamicImageColumn : DynamicActionColumn
  5. {
  6. public delegate BitmapImage? GetImageDelegate(CoreRow? row);
  7. public DynamicImageColumn(GetImageDelegate image, ActionDelegate? action = null)
  8. {
  9. Image = image;
  10. Action = action;
  11. VerticalHeader = true;
  12. }
  13. public DynamicImageColumn(BitmapImage image, ActionDelegate? action = null)
  14. {
  15. Image = r => image;
  16. Action = action;
  17. }
  18. public GetImageDelegate Image { get; protected set; }
  19. public bool AllowHeaderClick { get; set; } = false;
  20. public override object? Data(CoreRow? row) => Image?.Invoke(row);
  21. }