DFElementControl.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. using InABox.Core;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Windows;
  8. using System.Windows.Controls;
  9. using System.Windows.Media;
  10. namespace InABox.DynamicGrid
  11. {
  12. public class DFElementControl : DynamicFormControl<DFLayoutElement>
  13. {
  14. protected override FrameworkElement Create()
  15. {
  16. var element = FormDesignGrid.CreateElement(Control);
  17. if (element != null)
  18. return element;
  19. var result = new Border();
  20. result.Child = new Label
  21. {
  22. Content = string.Format("[{0}]", Control.Description),
  23. HorizontalContentAlignment = HorizontalAlignment.Center,
  24. VerticalContentAlignment = VerticalAlignment.Center,
  25. FontWeight = FontWeights.DemiBold
  26. };
  27. result.Background = new SolidColorBrush(Colors.Silver);
  28. result.BorderBrush = BorderBrush;
  29. result.BorderThickness = new Thickness(0.75);
  30. return result;
  31. }
  32. }
  33. }