| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 | using System;using System.Collections.Generic;using System.Linq;using System.Linq.Expressions;using System.Windows.Media.Imaging;using InABox.Core;using InABox.WPF;namespace InABox.DynamicGrid;public class DynamicTickColumn<T, P> : DynamicImageColumn where T : BaseObject, new() where P : struct{    private readonly BitmapImage? Data = Wpf.Resources.tick.AsBitmapImage();    private readonly BitmapImage? Header;    private readonly BitmapImage? NoData;    private readonly Expression<Func<T, P>> Property;    public DynamicTickColumn(Expression<Func<T, P>> property, BitmapImage? header, BitmapImage? data, BitmapImage? nodata,        ActionDelegate? action = null) : base(r => null, action)    {        Header = header;        Data = data;        NoData = nodata;        Property = property;        Image = GetImage;        GetFilter = () => new StaticColumnFilter<bool>(HasData, [            new("(Blank)", false),            new("(Not Blank)", true)        ]);    }    private BitmapImage? GetImage(CoreRow? row)    {        if (row == null)            return Header;        return HasData(row) ? Data : NoData;    }    private bool HasData(CoreRow row)    {        var value = row.Get(Property);        return !value.Equals(default(P));    }}
 |