22// Licensed under the MIT License. See the LICENSE.
33
44using Microsoft . UI . Xaml ;
5- using Microsoft . UI . Xaml . Controls ;
65using Microsoft . UI . Xaml . Media ;
76
87namespace Files . App . Controls
98{
10- public partial class ThemedIcon : Control
9+ public partial class ThemedIcon
1110 {
1211 #region FilledIconData (string)
1312
@@ -21,27 +20,22 @@ public partial class ThemedIcon : Control
2120 typeof ( ThemedIcon ) ,
2221 new PropertyMetadata ( string . Empty , ( d , e ) => ( ( ThemedIcon ) d ) . OnFilledIconPropertyChanged ( ( string ) e . OldValue , ( string ) e . NewValue ) ) ) ;
2322
24-
2523 /// <summary>
2624 /// Gets or sets the Filled Icon Path data as a String
2725 /// </summary>
2826 public string FilledIconData
2927 {
30- get => ( string ) GetValue ( FilledIconDataProperty ) ;
31- set => SetValue ( FilledIconDataProperty , value ) ;
28+ get => ( string ) GetValue ( FilledIconDataProperty ) ;
29+ set => SetValue ( FilledIconDataProperty , value ) ;
3230 }
3331
34-
35- protected virtual void OnFilledIconPropertyChanged ( string oldValue , string newValue )
32+ protected virtual void OnFilledIconPropertyChanged ( string oldValue , string newValue )
3633 {
3734 OnFilledIconChanged ( ) ;
3835 }
3936
4037 #endregion
4138
42-
43-
44-
4539 #region OutlineIconData (string)
4640
4741 /// <summary>
@@ -54,27 +48,22 @@ protected virtual void OnFilledIconPropertyChanged(string oldValue , string newV
5448 typeof ( ThemedIcon ) ,
5549 new PropertyMetadata ( string . Empty , ( d , e ) => ( ( ThemedIcon ) d ) . OnOutlineIconPropertyChanged ( ( string ) e . OldValue , ( string ) e . NewValue ) ) ) ;
5650
57-
5851 /// <summary>
5952 /// Gets or sets the Outline Icon Path data as a String
6053 /// </summary>
6154 public string OutlineIconData
6255 {
63- get => ( string ) GetValue ( OutlineIconDataProperty ) ;
64- set => SetValue ( OutlineIconDataProperty , value ) ;
56+ get => ( string ) GetValue ( OutlineIconDataProperty ) ;
57+ set => SetValue ( OutlineIconDataProperty , value ) ;
6558 }
6659
67-
68- protected virtual void OnOutlineIconPropertyChanged ( string oldValue , string newValue )
60+ protected virtual void OnOutlineIconPropertyChanged ( string oldValue , string newValue )
6961 {
7062 OnOutlineIconChanged ( ) ;
7163 }
7264
7365 #endregion
7466
75-
76-
77-
7867 #region Color (Brush)
7968
8069 /// <summary>
@@ -87,27 +76,22 @@ protected virtual void OnOutlineIconPropertyChanged(string oldValue , string new
8776 typeof ( ThemedIcon ) ,
8877 new PropertyMetadata ( null , ( d , e ) => ( ( ThemedIcon ) d ) . OnColorPropertyChanged ( ( Brush ) e . OldValue , ( Brush ) e . NewValue ) ) ) ;
8978
90-
9179 /// <summary>
9280 /// Gets or sets the Brush used for the Custom IconColorType
9381 /// </summary>
9482 public Brush Color
9583 {
96- get => ( Brush ) GetValue ( ColorProperty ) ;
97- set => SetValue ( ColorProperty , value ) ;
84+ get => ( Brush ) GetValue ( ColorProperty ) ;
85+ set => SetValue ( ColorProperty , value ) ;
9886 }
9987
100-
101- protected virtual void OnColorPropertyChanged ( Brush oldValue , Brush newValue )
88+ protected virtual void OnColorPropertyChanged ( Brush oldValue , Brush newValue )
10289 {
10390 OnIconTypeChanged ( ) ;
10491 }
10592
10693 #endregion
10794
108-
109-
110-
11195 #region IconType (enum ThemedIconTypes)
11296
11397 /// <summary>
@@ -120,27 +104,22 @@ protected virtual void OnColorPropertyChanged(Brush oldValue , Brush newValue)
120104 typeof ( ThemedIcon ) ,
121105 new PropertyMetadata ( ThemedIconTypes . Layered , ( d , e ) => ( ( ThemedIcon ) d ) . OnIconTypePropertyChanged ( ( ThemedIconTypes ) e . OldValue , ( ThemedIconTypes ) e . NewValue ) ) ) ;
122106
123-
124107 /// <summary>
125108 /// Gets or sets an Enum value to choose from our three icon types, Outline, Filled, Layered
126109 /// </summary>
127110 public ThemedIconTypes IconType
128111 {
129- get => ( ThemedIconTypes ) GetValue ( IconTypeProperty ) ;
130- set => SetValue ( IconTypeProperty , value ) ;
112+ get => ( ThemedIconTypes ) GetValue ( IconTypeProperty ) ;
113+ set => SetValue ( IconTypeProperty , value ) ;
131114 }
132115
133-
134- protected virtual void OnIconTypePropertyChanged ( ThemedIconTypes oldValue , ThemedIconTypes newValue )
116+ protected virtual void OnIconTypePropertyChanged ( ThemedIconTypes oldValue , ThemedIconTypes newValue )
135117 {
136118 OnIconTypeChanged ( ) ;
137119 }
138120
139121 #endregion
140122
141-
142-
143-
144123 #region IconColorType (enum ThemedIconColorType)
145124
146125 /// <summary>
@@ -153,27 +132,22 @@ protected virtual void OnIconTypePropertyChanged(ThemedIconTypes oldValue , Them
153132 typeof ( ThemedIcon ) ,
154133 new PropertyMetadata ( ThemedIconColorType . None , ( d , e ) => ( ( ThemedIcon ) d ) . OnIconColorTypePropertyChanged ( ( ThemedIconColorType ) e . OldValue , ( ThemedIconColorType ) e . NewValue ) ) ) ;
155134
156-
157135 /// <summary>
158136 /// Gets or sets Enum values to choose from our icon states, Normal, Critical, Caution, Success, Neutral, Disabled
159137 /// </summary>
160138 public ThemedIconColorType IconColorType
161139 {
162- get => ( ThemedIconColorType ) GetValue ( IconColorTypeProperty ) ;
163- set => SetValue ( IconColorTypeProperty , value ) ;
140+ get => ( ThemedIconColorType ) GetValue ( IconColorTypeProperty ) ;
141+ set => SetValue ( IconColorTypeProperty , value ) ;
164142 }
165143
166-
167- protected virtual void OnIconColorTypePropertyChanged ( ThemedIconColorType oldValue , ThemedIconColorType newValue )
144+ protected virtual void OnIconColorTypePropertyChanged ( ThemedIconColorType oldValue , ThemedIconColorType newValue )
168145 {
169146 OnIconColorTypeChanged ( ) ;
170147 }
171148
172149 #endregion
173150
174-
175-
176-
177151 #region IconSize (double)
178152
179153 /// <summary>
@@ -186,27 +160,22 @@ protected virtual void OnIconColorTypePropertyChanged(ThemedIconColorType oldVal
186160 typeof ( ThemedIcon ) ,
187161 new PropertyMetadata ( ( double ) 16 , ( d , e ) => ( ( ThemedIcon ) d ) . OnIconSizePropertyChanged ( ( double ) e . OldValue , ( double ) e . NewValue ) ) ) ;
188162
189-
190163 /// <summary>
191164 /// Gets or sets a value indicating the Icon's design size.
192165 /// </summary>
193166 public double IconSize
194167 {
195- get => ( double ) GetValue ( IconSizeProperty ) ;
196- set => SetValue ( IconSizeProperty , value ) ;
168+ get => ( double ) GetValue ( IconSizeProperty ) ;
169+ set => SetValue ( IconSizeProperty , value ) ;
197170 }
198171
199-
200- protected virtual void OnIconSizePropertyChanged ( double oldValue , double newValue )
172+ protected virtual void OnIconSizePropertyChanged ( double oldValue , double newValue )
201173 {
202174 UpdateVisualStates ( ) ;
203175 }
204176
205177 #endregion
206178
207-
208-
209-
210179 #region ToggleBehavior (enum ToggleBehaviors)
211180
212181 /// <summary>
@@ -219,27 +188,22 @@ protected virtual void OnIconSizePropertyChanged(double oldValue , double newVal
219188 typeof ( ThemedIcon ) ,
220189 new PropertyMetadata ( defaultValue : ToggleBehaviors . Auto , ( d , e ) => ( ( ThemedIcon ) d ) . OnToggleBehaviorPropertyChanged ( ( ToggleBehaviors ) e . OldValue , ( ToggleBehaviors ) e . NewValue ) ) ) ;
221190
222-
223191 /// <summary>
224192 /// Gets or sets a value indicating whether the Icon should use Toggled states.
225193 /// </summary>
226194 public ToggleBehaviors ToggleBehavior
227195 {
228- get => ( ToggleBehaviors ) GetValue ( ToggleBehaviorProperty ) ;
229- set => SetValue ( ToggleBehaviorProperty , value ) ;
196+ get => ( ToggleBehaviors ) GetValue ( ToggleBehaviorProperty ) ;
197+ set => SetValue ( ToggleBehaviorProperty , value ) ;
230198 }
231199
232-
233- protected virtual void OnToggleBehaviorPropertyChanged ( ToggleBehaviors oldValue , ToggleBehaviors newValue )
200+ protected virtual void OnToggleBehaviorPropertyChanged ( ToggleBehaviors oldValue , ToggleBehaviors newValue )
234201 {
235202 UpdateVisualStates ( ) ;
236203 }
237204
238205 #endregion
239206
240-
241-
242-
243207 #region IsFilled (bool)
244208
245209 /// <summary>
@@ -252,27 +216,22 @@ protected virtual void OnToggleBehaviorPropertyChanged(ToggleBehaviors oldValue
252216 typeof ( ThemedIcon ) ,
253217 new PropertyMetadata ( defaultValue : false , ( d , e ) => ( ( ThemedIcon ) d ) . OnIsFilledPropertyChanged ( ( bool ) e . OldValue , ( bool ) e . NewValue ) ) ) ;
254218
255-
256219 /// <summary>
257220 /// Gets or sets a value indicating whether the Icon should use Filled states.
258221 /// </summary>
259222 public bool IsFilled
260223 {
261- get => ( bool ) GetValue ( IsFilledProperty ) ;
262- set => SetValue ( IsFilledProperty , value ) ;
224+ get => ( bool ) GetValue ( IsFilledProperty ) ;
225+ set => SetValue ( IsFilledProperty , value ) ;
263226 }
264227
265-
266- protected virtual void OnIsFilledPropertyChanged ( bool oldValue , bool newValue )
228+ protected virtual void OnIsFilledPropertyChanged ( bool oldValue , bool newValue )
267229 {
268230 UpdateVisualStates ( ) ;
269231 }
270232
271233 #endregion
272234
273-
274-
275-
276235 #region IsHighContrast (bool)
277236
278237 /// <summary>
@@ -285,27 +244,22 @@ protected virtual void OnIsFilledPropertyChanged(bool oldValue , bool newValue)
285244 typeof ( ThemedIcon ) ,
286245 new PropertyMetadata ( defaultValue : false , ( d , e ) => ( ( ThemedIcon ) d ) . OnIsHighContrastPropertyChanged ( ( bool ) e . OldValue , ( bool ) e . NewValue ) ) ) ;
287246
288-
289247 /// <summary>
290248 /// Gets or sets a value indicating whether the Icon is in HighContrast state.
291249 /// </summary>
292250 public bool IsHighContrast
293251 {
294- get => ( bool ) GetValue ( IsHighContrastProperty ) ;
295- set => SetValue ( IsHighContrastProperty , value ) ;
252+ get => ( bool ) GetValue ( IsHighContrastProperty ) ;
253+ set => SetValue ( IsHighContrastProperty , value ) ;
296254 }
297255
298-
299- protected virtual void OnIsHighContrastPropertyChanged ( bool oldValue , bool newValue )
256+ protected virtual void OnIsHighContrastPropertyChanged ( bool oldValue , bool newValue )
300257 {
301258 UpdateVisualStates ( ) ;
302259 }
303260
304261 #endregion
305262
306-
307-
308-
309263 #region Layers (object)
310264
311265 /// <summary>
@@ -318,23 +272,20 @@ protected virtual void OnIsHighContrastPropertyChanged(bool oldValue , bool newV
318272 typeof ( ThemedIcon ) ,
319273 new PropertyMetadata ( null , ( d , e ) => ( ( ThemedIcon ) d ) . OnLayersPropertyChanged ( ( object ) e . OldValue , ( object ) e . NewValue ) ) ) ;
320274
321-
322275 /// <summary>
323276 /// Gets or sets the objects we use as Layers for the Layered Icon.
324277 /// </summary>
325278 public object Layers
326279 {
327- get => ( object ) GetValue ( LayersProperty ) ;
328- set => SetValue ( LayersProperty , value ) ;
280+ get => ( object ) GetValue ( LayersProperty ) ;
281+ set => SetValue ( LayersProperty , value ) ;
329282 }
330283
331-
332- protected virtual void OnLayersPropertyChanged ( object oldValue , object newValue )
284+ protected virtual void OnLayersPropertyChanged ( object oldValue , object newValue )
333285 {
334286 OnLayeredIconChanged ( ) ;
335287 }
336288
337289 #endregion
338-
339290 }
340291}
0 commit comments