55
66namespace Files . App . Controls
77{
8+ [ DependencyProperty < double > ( "ValueBarHeight" , nameof ( OnValueBarHeightChanged ) , DefaultValue = "(double)4.0" ) ]
9+ [ DependencyProperty < double > ( "TrackBarHeight" , nameof ( OnTrackBarHeightChanged ) , DefaultValue = "(double)2.0" ) ]
10+ [ DependencyProperty < BarShapes > ( "BarShape" , nameof ( OnBarShapeChanged ) , DefaultValue = "BarShapes.Round" ) ]
11+ [ DependencyProperty < double > ( "Percent" , nameof ( OnPercentChanged ) , DefaultValue = "(double)0.0" ) ]
12+ [ DependencyProperty < double > ( "PercentCaution" , nameof ( OnPercentCautionChanged ) , DefaultValue = "(double)75.1" ) ]
13+ [ DependencyProperty < double > ( "PercentCritical" , nameof ( OnPercentCriticalChanged ) , DefaultValue = "(double)89.9" ) ]
814 public partial class StorageBar
915 {
10- #region Value Bar Height (double)
11-
12- /// <summary>
13- /// Identifies the ValueBarHeight dependency property.
14- /// </summary>
15- public static readonly DependencyProperty ValueBarHeightProperty =
16- DependencyProperty . Register (
17- nameof ( ValueBarHeight ) ,
18- typeof ( double ) ,
19- typeof ( StorageBar ) ,
20- new PropertyMetadata ( 4.0 , ( d , e ) => ( ( StorageBar ) d ) . OnValueBarHeightChanged ( ( double ) e . OldValue , ( double ) e . NewValue ) ) ) ;
21-
22- /// <summary>
23- /// Gets or sets the height of the Value Bar.
24- /// </summary>
25- public double ValueBarHeight
26- {
27- get => ( double ) GetValue ( ValueBarHeightProperty ) ;
28- set => SetValue ( ValueBarHeightProperty , value ) ;
29- }
30-
3116 private void OnValueBarHeightChanged ( double oldValue , double newValue )
3217 {
3318 UpdateControl ( this ) ;
3419 }
3520
36- #endregion
37-
38- #region Track Bar Height (double)
39-
40- /// <summary>
41- /// Identifies the TrackBarHeight dependency property.
42- /// </summary>
43- public static readonly DependencyProperty TrackBarHeightProperty =
44- DependencyProperty . Register (
45- nameof ( TrackBarHeight ) ,
46- typeof ( double ) ,
47- typeof ( StorageBar ) ,
48- new PropertyMetadata ( 2.0 , ( d , e ) => ( ( StorageBar ) d ) . OnTrackBarHeightChanged ( ( double ) e . OldValue , ( double ) e . NewValue ) ) ) ;
49-
50- /// <summary>
51- /// Gets or sets the height of the Track Bar.
52- /// </summary>
53- public double TrackBarHeight
54- {
55- get => ( double ) GetValue ( TrackBarHeightProperty ) ;
56- set => SetValue ( TrackBarHeightProperty , value ) ;
57- }
58-
5921 private void OnTrackBarHeightChanged ( double oldValue , double newValue )
6022 {
6123 UpdateControl ( this ) ;
6224 }
6325
64- #endregion
65-
66- #region BarShape (BarShapes)
67-
68- /// <summary>
69- /// Identifies the BarShape dependency property.
70- /// </summary>
71- public static readonly DependencyProperty BarShapeProperty =
72- DependencyProperty . Register (
73- nameof ( BarShape ) ,
74- typeof ( BarShapes ) ,
75- typeof ( StorageBar ) ,
76- new PropertyMetadata ( BarShapes . Round , ( d , e ) => ( ( StorageBar ) d ) . OnBarShapeChanged ( ( BarShapes ) e . OldValue , ( BarShapes ) e . NewValue ) ) ) ;
77-
78- /// <summary>
79- /// Gets or sets an Enum value to choose from our two BarShapes. (Round, Flat)
80- /// </summary>
81- public BarShapes BarShape
82- {
83- get => ( BarShapes ) GetValue ( BarShapeProperty ) ;
84- set => SetValue ( BarShapeProperty , value ) ;
85- }
86-
8726 private void OnBarShapeChanged ( BarShapes oldValue , BarShapes newValue )
8827 {
8928 UpdateControl ( this ) ;
9029 }
9130
92- #endregion
93-
94- #region Percent (double)
95-
96- /// <summary>
97- /// Identifies the Percent dependency property.
98- /// </summary>
99- public static readonly DependencyProperty PercentProperty =
100- DependencyProperty . Register (
101- nameof ( Percent ) ,
102- typeof ( double ) ,
103- typeof ( StorageBar ) ,
104- new PropertyMetadata ( 0.0 , ( d , e ) => ( ( StorageBar ) d ) . OnPercentChanged ( ( double ) e . OldValue , ( double ) e . NewValue ) ) ) ;
105-
106- /// <summary>
107- /// Gets or sets the current value as a Percentage between 0.0 and 100.0.
108- /// </summary>
109- public double Percent
110- {
111- get => ( double ) GetValue ( PercentProperty ) ;
112- set => SetValue ( PercentProperty , value ) ;
113- }
114-
11531 private void OnPercentChanged ( double oldValue , double newValue )
11632 {
11733 return ; //Read-only
11834
11935 DoubleToPercentage ( Value , Minimum , Maximum ) ;
120-
12136 UpdateControl ( this ) ;
12237 }
12338
124- #endregion
125-
126- #region PercentWarning (double)
127-
128- /// <summary>
129- /// Identifies the PercentCaution dependency property.
130- /// </summary>
131- public static readonly DependencyProperty PercentCautionProperty =
132- DependencyProperty . Register (
133- nameof ( PercentCaution ) ,
134- typeof ( double ) ,
135- typeof ( StorageBar ) ,
136- new PropertyMetadata ( 75.1 , ( d , e ) => ( ( StorageBar ) d ) . OnPercentCautionChanged ( ( double ) e . OldValue , ( double ) e . NewValue ) ) ) ;
137-
138- /// <summary>
139- /// Gets or sets the PercentCaution double value.
140- /// </summary>
141- public double PercentCaution
142- {
143- get => ( double ) GetValue ( PercentCautionProperty ) ;
144- set => SetValue ( PercentCautionProperty , value ) ;
145- }
146-
14739 private void OnPercentCautionChanged ( double oldValue , double newValue )
14840 {
14941 UpdateControl ( this ) ;
15042 }
15143
152- #endregion
153-
154- #region PercentCritical (double)
155-
156- /// <summary>
157- /// Identifies the PercentCritical dependency property.
158- /// </summary>
159- public static readonly DependencyProperty PercentCriticalProperty =
160- DependencyProperty . Register (
161- nameof ( PercentCritical ) ,
162- typeof ( double ) ,
163- typeof ( StorageBar ) ,
164- new PropertyMetadata ( 89.9 , ( d , e ) => ( ( StorageBar ) d ) . OnPercentCriticalChanged ( ( double ) e . OldValue , ( double ) e . NewValue ) ) ) ;
165-
166- /// <summary>
167- /// Gets or sets the PercentCritical double value.
168- /// </summary>
169- public double PercentCritical
170- {
171- get => ( double ) GetValue ( PercentCriticalProperty ) ;
172- set => SetValue ( PercentCriticalProperty , value ) ;
173- }
174-
17544 private void OnPercentCriticalChanged ( double oldValue , double newValue )
17645 {
17746 UpdateControl ( this ) ;
17847 }
17948
180- #endregion
181-
182- #region Derived RangeBase Events
183-
18449 /// <inheritdoc/>
18550 protected override void OnValueChanged ( double oldValue , double newValue )
18651 {
@@ -202,7 +67,5 @@ protected override void OnMinimumChanged(double oldValue, double newValue)
20267 base . OnMinimumChanged ( oldValue , newValue ) ;
20368 UpdateValue ( this , oldValue , newValue , false , - 1.0 ) ;
20469 }
205-
206- #endregion
20770 }
20871}
0 commit comments