AITScComboBoxRow.xaml.cs 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. using System.Collections.Generic;
  2. using System.Windows;
  3. using System.Windows.Controls;
  4. using System.Windows.Input;
  5. using System.Windows.Media;
  6. namespace MECF.Framework.UI.Core.CommonControl
  7. {
  8. /// <summary>
  9. /// AITSCRow.xaml 的交互逻辑
  10. /// </summary>
  11. public partial class AITScComboBoxRow : UserControl
  12. {
  13. public static readonly DependencyProperty CommandProperty = DependencyProperty.Register(
  14. "Command", typeof(ICommand), typeof(AITScComboBoxRow),
  15. new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.AffectsRender));
  16. public ICommand Command
  17. {
  18. get
  19. {
  20. return (ICommand)this.GetValue(CommandProperty);
  21. }
  22. set
  23. {
  24. this.SetValue(CommandProperty, value);
  25. }
  26. }
  27. public static readonly DependencyProperty NameWidthProperty = DependencyProperty.Register(
  28. "NameWidth", typeof(int), typeof(AITScComboBoxRow),
  29. new FrameworkPropertyMetadata(180, FrameworkPropertyMetadataOptions.AffectsRender));
  30. public int NameWidth
  31. {
  32. get
  33. {
  34. return (int)this.GetValue(NameWidthProperty);
  35. }
  36. set
  37. {
  38. this.SetValue(NameWidthProperty, value);
  39. }
  40. }
  41. public static readonly DependencyProperty FeedbackWidthProperty = DependencyProperty.Register(
  42. "FeedbackWidth", typeof(int), typeof(AITScComboBoxRow),
  43. new FrameworkPropertyMetadata(90, FrameworkPropertyMetadataOptions.AffectsRender));
  44. public int FeedbackWidth
  45. {
  46. get
  47. {
  48. return (int)this.GetValue(FeedbackWidthProperty);
  49. }
  50. set
  51. {
  52. this.SetValue(FeedbackWidthProperty, value);
  53. }
  54. }
  55. public static readonly DependencyProperty SetPointWidthProperty = DependencyProperty.Register(
  56. "SetPointWidth", typeof(int), typeof(AITScComboBoxRow),
  57. new FrameworkPropertyMetadata(90, FrameworkPropertyMetadataOptions.AffectsRender));
  58. public int SetPointWidth
  59. {
  60. get
  61. {
  62. return (int)this.GetValue(SetPointWidthProperty);
  63. }
  64. set
  65. {
  66. this.SetValue(SetPointWidthProperty, value);
  67. }
  68. }
  69. public static readonly DependencyProperty CommandWidthProperty = DependencyProperty.Register(
  70. "CommandWidth", typeof(int), typeof(AITScComboBoxRow),
  71. new FrameworkPropertyMetadata(90, FrameworkPropertyMetadataOptions.AffectsRender));
  72. public int CommandWidth
  73. {
  74. get
  75. {
  76. return (int)this.GetValue(CommandWidthProperty);
  77. }
  78. set
  79. {
  80. this.SetValue(CommandWidthProperty, value);
  81. }
  82. }
  83. public static readonly DependencyProperty ScIdProperty = DependencyProperty.Register(
  84. "ScId", typeof(string), typeof(AITScComboBoxRow),
  85. new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.AffectsRender));
  86. public string ScId
  87. {
  88. get
  89. {
  90. return (string)this.GetValue(ScIdProperty);
  91. }
  92. set
  93. {
  94. this.SetValue(ScIdProperty, value);
  95. }
  96. }
  97. public static readonly DependencyProperty ScNameProperty = DependencyProperty.Register(
  98. "ScName", typeof(string), typeof(AITScComboBoxRow),
  99. new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.AffectsRender));
  100. public string ScName
  101. {
  102. get
  103. {
  104. return (string)this.GetValue(ScNameProperty);
  105. }
  106. set
  107. {
  108. this.SetValue(ScNameProperty, value);
  109. }
  110. }
  111. public static readonly DependencyProperty ScItemSourceProperty = DependencyProperty.Register(
  112. "ScItemSource", typeof(List<string>), typeof(AITScComboBoxRow),
  113. new FrameworkPropertyMetadata(new List<string>()));
  114. public List<string> ScItemSource
  115. {
  116. get { return (List<string>) this.GetValue(ScItemSourceProperty); }
  117. set { this.SetValue(ScItemSourceProperty, value); }
  118. }
  119. public static readonly DependencyProperty ScFeedbackProperty = DependencyProperty.Register(
  120. "ScFeedback", typeof(string), typeof(AITScComboBoxRow),
  121. new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.AffectsRender));
  122. public double ScFeedback
  123. {
  124. get
  125. {
  126. return (double)this.GetValue(ScFeedbackProperty);
  127. }
  128. set
  129. {
  130. this.SetValue(ScFeedbackProperty, value);
  131. }
  132. }
  133. public static readonly DependencyProperty ScSetPointProperty = DependencyProperty.Register(
  134. "ScSetPoint", typeof(string), typeof(AITScComboBoxRow),
  135. new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.AffectsRender));
  136. public string ScSetPoint
  137. {
  138. get
  139. {
  140. return (string)this.GetValue(ScSetPointProperty);
  141. }
  142. set
  143. {
  144. this.SetValue(ScSetPointProperty, value);
  145. }
  146. }
  147. public AITScComboBoxRow()
  148. {
  149. InitializeComponent();
  150. }
  151. protected override void OnRender(DrawingContext drawingContext)
  152. {
  153. this.cmb.SelectedValue = ScSetPoint;
  154. base.OnRender(drawingContext);
  155. }
  156. private void Button_Click(object sender, RoutedEventArgs e)
  157. {
  158. Command.Execute(new object[] { ScId, ScSetPoint.ToString()});
  159. }
  160. }
  161. }