GasFlowButton.xaml.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Windows;
  6. using System.Windows.Controls;
  7. using System.Windows.Data;
  8. using System.Windows.Documents;
  9. using System.Windows.Input;
  10. using System.Windows.Media;
  11. using System.Windows.Media.Imaging;
  12. using System.Windows.Navigation;
  13. using System.Windows.Shapes;
  14. namespace Aitex.Core.UI.Control
  15. {
  16. /// <summary>
  17. /// Interaction logic for GasFlowButton.xaml
  18. /// </summary>
  19. public partial class GasFlowButton : UserControl
  20. {
  21. public GasFlowButton()
  22. {
  23. InitializeComponent();
  24. }
  25. public static readonly DependencyProperty Flow2RightProperty = DependencyProperty.Register(
  26. "Flow2Right", typeof(bool), typeof(GasFlowButton),
  27. new FrameworkPropertyMetadata(true,FrameworkPropertyMetadataOptions.AffectsRender));
  28. public bool Flow2Right
  29. {
  30. get { return (bool)this.GetValue(Flow2RightProperty); }
  31. set { this.SetValue(Flow2RightProperty, value); }
  32. }
  33. protected override void OnRender(DrawingContext drawingContext)
  34. {
  35. base.OnRender(drawingContext);
  36. if (!Flow2Right)
  37. {
  38. Canvas.SetLeft(btnFlow, 54);
  39. Canvas.SetLeft(btnGas, 103);
  40. Canvas.SetLeft(btnCarrierGas, 182);
  41. }
  42. }
  43. }
  44. }