DynamicGridDateColumn.cs 873 B

123456789101112131415161718192021222324252627282930
  1. using System.Windows.Controls;
  2. using System.Windows.Data;
  3. using InABox.Core;
  4. using InABox.WPF;
  5. using Microsoft.Xaml.Behaviors;
  6. namespace InABox.DynamicGrid;
  7. public class DynamicGridDateColumn<TEntity> : DynamicGridMaskColumn<TEntity,DateEditor>
  8. where TEntity : BaseObject
  9. {
  10. protected override Behavior CreateBehaviour() =>
  11. new TextBoxDateMaskBehavior(Definition?.Format);
  12. protected override IValueConverter CreateConverter() =>
  13. new DateToStringConverter(Definition?.Format);
  14. protected override Button[] CreateButtons(TextBox textbox)
  15. {
  16. var button = new Button();
  17. button.Content = "x";
  18. button.Width = 25;
  19. button.Click += (sender, args) => textbox.Text = "";
  20. return new Button[] { button };
  21. }
  22. public DynamicGridDateColumn(DynamicGridColumn definition) : base(definition)
  23. {
  24. }
  25. }