DynamicGridTimeStampColumn.cs 938 B

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