123456789101112131415161718192021222324252627282930313233 |
- using System.Drawing;
- using System.Windows.Media.Imaging;
- using InABox.Core;
- using InABox.WPF;
- namespace InABox.DynamicGrid;
- public class DynamicImageColumn : DynamicActionColumn
- {
- private static readonly BitmapImage empty = new Bitmap(32, 32).ToBitmapImage();
- public delegate BitmapImage? GetImageDelegate(CoreRow? row);
- public DynamicImageColumn(GetImageDelegate image, ActionDelegate? action = null)
- {
- Image = image;
- Action = action;
- VerticalHeader = true;
- }
- public DynamicImageColumn(BitmapImage image, ActionDelegate? action = null)
- {
- Image = r => image;
- Action = action;
- }
- public GetImageDelegate Image { get; protected set; }
- public bool AllowHeaderClick { get; set; } = false;
-
- public override object? Data(CoreRow? row) => Image?.Invoke(row) ?? empty;
- }
|