DFElementControl.cs 1.1 KB

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