No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

ProgressBarHelper.cs 3.0 KiB

hace 1 año
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. using BPA.UIControl.Commons.KnownBoxes;
  2. using System.Windows;
  3. namespace BPA.UIControl
  4. {
  5. /// <summary>
  6. /// ProgressBar 帮助类
  7. /// </summary>
  8. public static class ProgressBarHelper
  9. {
  10. /// <summary>
  11. /// 厚度
  12. /// </summary>
  13. public static readonly DependencyProperty ThicknessProperty = DependencyProperty.RegisterAttached(
  14. "Thickness", typeof(double), typeof(ProgressBarHelper));
  15. /// <summary>
  16. /// Sets the thickness.
  17. /// </summary>
  18. /// <param name="element">The element.</param>
  19. /// <param name="value">The value.</param>
  20. public static void SetThickness(DependencyObject element, double value)
  21. {
  22. element.SetValue(ThicknessProperty, value);
  23. }
  24. /// <summary>
  25. /// Gets the thickness.
  26. /// </summary>
  27. /// <param name="element">The element.</param>
  28. /// <returns>A double.</returns>
  29. public static double GetThickness(DependencyObject element)
  30. {
  31. return (double)element.GetValue(ThicknessProperty);
  32. }
  33. /// <summary>
  34. /// 是否显示百分比
  35. /// </summary>
  36. public static readonly DependencyProperty ShowPercentProperty =
  37. DependencyProperty.RegisterAttached("ShowPercent", typeof(bool), typeof(ProgressBarHelper), new PropertyMetadata(BooleanBoxes.FalseBox));
  38. /// <summary>
  39. /// Gets the show percent.
  40. /// </summary>
  41. /// <param name="obj">The obj.</param>
  42. /// <returns>A bool.</returns>
  43. public static bool GetShowPercent(DependencyObject obj)
  44. {
  45. return (bool)obj.GetValue(ShowPercentProperty);
  46. }
  47. /// <summary>
  48. /// Sets the show percent.
  49. /// </summary>
  50. /// <param name="obj">The obj.</param>
  51. /// <param name="value">If true, value.</param>
  52. public static void SetShowPercent(DependencyObject obj, bool value)
  53. {
  54. obj.SetValue(ShowPercentProperty, BooleanBoxes.Box(value));
  55. }
  56. /// <summary>
  57. /// 不确定进度值
  58. /// </summary>
  59. public static readonly DependencyProperty IndeterminateValueProperty =
  60. DependencyProperty.RegisterAttached("IndeterminateValue", typeof(double), typeof(ProgressBarHelper));
  61. /// <summary>
  62. /// Gets the indeterminate value.
  63. /// </summary>
  64. /// <param name="obj">The obj.</param>
  65. /// <returns>A double.</returns>
  66. public static double GetIndeterminateValue(DependencyObject obj)
  67. {
  68. return (double)obj.GetValue(IndeterminateValueProperty);
  69. }
  70. /// <summary>
  71. /// Sets the indeterminate value.
  72. /// </summary>
  73. /// <param name="obj">The obj.</param>
  74. /// <param name="value">The value.</param>
  75. public static void SetIndeterminateValue(DependencyObject obj, double value)
  76. {
  77. obj.SetValue(IndeterminateValueProperty, value);
  78. }
  79. }
  80. }