CheckValve.xaml.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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 CheckValve_V2.xaml
  18. /// </summary>
  19. public partial class CheckValve : UserControl
  20. {
  21. public CheckValve()
  22. {
  23. InitializeComponent();
  24. }
  25. public static readonly DependencyProperty DisplayAngleProperty = DependencyProperty.Register(
  26. "Angle", typeof(int), typeof(CheckValve),
  27. new FrameworkPropertyMetadata(0, FrameworkPropertyMetadataOptions.AffectsRender));
  28. /// <summary>
  29. /// display angle
  30. /// </summary>
  31. public int Angle
  32. {
  33. get
  34. {
  35. return (int)GetValue(DisplayAngleProperty);
  36. }
  37. set
  38. {
  39. SetValue(DisplayAngleProperty, value);
  40. }
  41. }
  42. /// <summary>
  43. /// override rendering method
  44. /// </summary>
  45. /// <param name="drawingContext"></param>
  46. protected override void OnRender(DrawingContext drawingContext)
  47. {
  48. base.OnRender(drawingContext);
  49. this.rotateTransform.Angle = Angle;
  50. }
  51. }
  52. }