Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

183 řádky
7.0 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  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.Data;
  10. using System.Windows.Documents;
  11. using System.Windows.Input;
  12. using System.Windows.Media;
  13. using System.Windows.Media.Imaging;
  14. using System.Windows.Navigation;
  15. using System.Windows.Shapes;
  16. namespace BPA.UIControl
  17. {
  18. /// <summary>
  19. /// 描述控件子项
  20. /// </summary>
  21. public class DescriptionItem : ContentControl
  22. {
  23. #region properties
  24. /// <summary>
  25. /// 描述
  26. /// </summary>
  27. public static readonly DependencyProperty DescriptionProperty =
  28. DependencyProperty.Register("Description", typeof(object), typeof(DescriptionItem), new PropertyMetadata(default(object)));
  29. /// <summary>
  30. /// 描述
  31. /// </summary>
  32. public object Description
  33. {
  34. get { return (object)GetValue(DescriptionProperty); }
  35. set { SetValue(DescriptionProperty, value); }
  36. }
  37. /// <summary>
  38. /// 描述列宽
  39. /// </summary>
  40. public static readonly DependencyProperty DescriptionWidthProperty =
  41. DependencyProperty.Register("DescriptionWidth", typeof(GridLength), typeof(DescriptionItem), new PropertyMetadata(GridLength.Auto));
  42. /// <summary>
  43. /// 描述列宽
  44. /// </summary>
  45. public GridLength DescriptionWidth
  46. {
  47. get { return (GridLength)GetValue(DescriptionWidthProperty); }
  48. internal set { SetValue(DescriptionWidthProperty, value); }
  49. }
  50. /// <summary>
  51. /// 描述背景色
  52. /// </summary>
  53. public static readonly DependencyProperty DescriptionBackgroundProperty =
  54. DependencyProperty.Register("DescriptionBackground", typeof(Brush), typeof(DescriptionItem), new PropertyMetadata(default(Brush)));
  55. /// <summary>
  56. /// 描述背景色
  57. /// </summary>
  58. public Brush DescriptionBackground
  59. {
  60. get { return (Brush)GetValue(DescriptionBackgroundProperty); }
  61. set { SetValue(DescriptionBackgroundProperty, value); }
  62. }
  63. /// <summary>
  64. /// 描述前景色
  65. /// </summary>
  66. public static readonly DependencyProperty DescriptionForegroundProperty =
  67. DependencyProperty.Register("DescriptionForeground", typeof(Brush), typeof(DescriptionItem), new PropertyMetadata(default(Brush)));
  68. /// <summary>
  69. /// 描述前景色
  70. /// </summary>
  71. public Brush DescriptionForeground
  72. {
  73. get { return (Brush)GetValue(DescriptionForegroundProperty); }
  74. set { SetValue(DescriptionForegroundProperty, value); }
  75. }
  76. /// <summary>
  77. /// 描述字体大小
  78. /// </summary>
  79. public static readonly DependencyProperty DescriptionFontSizeProperty =
  80. DependencyProperty.Register("DescriptionFontSize", typeof(double), typeof(DescriptionItem), new FrameworkPropertyMetadata(SystemFonts.CaptionFontSize, FrameworkPropertyMetadataOptions.AffectsParentMeasure));
  81. /// <summary>
  82. /// 描述字体大小
  83. /// </summary>
  84. public double DescriptionFontSize
  85. {
  86. get { return (double)GetValue(DescriptionFontSizeProperty); }
  87. set { SetValue(DescriptionFontSizeProperty, value); }
  88. }
  89. /// <summary>
  90. /// 描述字体加粗
  91. /// </summary>
  92. public static readonly DependencyProperty DescriptionFontWeightProperty =
  93. DependencyProperty.Register("DescriptionFontWeight", typeof(FontWeight), typeof(DescriptionItem), new FrameworkPropertyMetadata(SystemFonts.CaptionFontWeight, FrameworkPropertyMetadataOptions.AffectsParentMeasure));
  94. /// <summary>
  95. /// 描述字体加粗
  96. /// </summary>
  97. public FontWeight DescriptionFontWeight
  98. {
  99. get { return (FontWeight)GetValue(DescriptionFontWeightProperty); }
  100. set { SetValue(DescriptionFontWeightProperty, value); }
  101. }
  102. /// <summary>
  103. /// 描述格边框厚度
  104. /// </summary>
  105. public static readonly DependencyProperty DescriptionBorderThicknessProperty =
  106. DependencyProperty.Register("DescriptionBorderThickness", typeof(Thickness), typeof(DescriptionItem), new FrameworkPropertyMetadata(default(Thickness), FrameworkPropertyMetadataOptions.AffectsParentMeasure));
  107. /// <summary>
  108. /// 描述格边框厚度
  109. /// </summary>
  110. public Thickness DescriptionBorderThickness
  111. {
  112. get { return (Thickness)GetValue(DescriptionBorderThicknessProperty); }
  113. internal set { SetValue(DescriptionBorderThicknessProperty, value); }
  114. }
  115. /// <summary>
  116. /// 描述水平对齐
  117. /// </summary>
  118. public static readonly DependencyProperty HorizontalDescriptionAlignmentProperty =
  119. DependencyProperty.Register("HorizontalDescriptionAlignment", typeof(HorizontalAlignment), typeof(DescriptionItem), new FrameworkPropertyMetadata(default(HorizontalAlignment)));
  120. /// <summary>
  121. /// 描述水平对齐
  122. /// </summary>
  123. public HorizontalAlignment HorizontalDescriptionAlignment
  124. {
  125. get { return (HorizontalAlignment)GetValue(HorizontalDescriptionAlignmentProperty); }
  126. set { SetValue(HorizontalDescriptionAlignmentProperty, value); }
  127. }
  128. /// <summary>
  129. /// 描述垂直对齐
  130. /// </summary>
  131. public static readonly DependencyProperty VerticalDescriptionAlignmentProperty =
  132. DependencyProperty.Register("VerticalDescriptionAlignment", typeof(VerticalAlignment), typeof(DescriptionItem), new FrameworkPropertyMetadata(default(VerticalAlignment)));
  133. /// <summary>
  134. /// 描述垂直对齐
  135. /// </summary>
  136. public VerticalAlignment VerticalDescriptionAlignment
  137. {
  138. get { return (VerticalAlignment)GetValue(VerticalDescriptionAlignmentProperty); }
  139. set { SetValue(VerticalDescriptionAlignmentProperty, value); }
  140. }
  141. /// <summary>
  142. /// 内容格边框厚度
  143. /// </summary>
  144. public static readonly DependencyProperty ContentBorderThicknessProperty =
  145. DependencyProperty.Register("ContentBorderThickness", typeof(Thickness), typeof(DescriptionItem), new FrameworkPropertyMetadata(default(Thickness), FrameworkPropertyMetadataOptions.AffectsParentMeasure));
  146. /// <summary>
  147. /// 内容格边框厚度
  148. /// </summary>
  149. public Thickness ContentBorderThickness
  150. {
  151. get { return (Thickness)GetValue(ContentBorderThicknessProperty); }
  152. internal set { SetValue(ContentBorderThicknessProperty, value); }
  153. }
  154. #endregion properties
  155. static DescriptionItem()
  156. {
  157. DefaultStyleKeyProperty.OverrideMetadata(typeof(DescriptionItem), new FrameworkPropertyMetadata(typeof(DescriptionItem)));
  158. }
  159. }
  160. }