using System; using System.Linq.Expressions; using System.Windows.Media.Imaging; using InABox.Core; using InABox.DynamicGrid; using InABox.WPF; namespace PRSDesktop { public class DynamicCheckColumn : DynamicImageColumn { private readonly BitmapImage Disabled = Resources.tick.AsGrayScale().AsBitmapImage(); private readonly BitmapImage Enabled = Resources.tick.AsBitmapImage(); private readonly BitmapImage Header; private readonly Expression> Property; public DynamicCheckColumn(BitmapImage header, Expression> property) : base(r => null) { Header = header; Property = property; Image = GetImage; Action = null; } private BitmapImage GetImage(CoreRow row) { if (row == null) return Header; var Checked = row.Get(Property).Equals(true); return Checked ? Enabled : Disabled; } } }