@@ -257,14 +257,6 @@ private static void DependencyObjectsReferences_DependencyObjectRemoved(object?
257257 return null ;
258258 }
259259
260- private void LocalizeDependencyObjectsWithoutDependencyProperty ( DependencyObject dependencyObject , string value )
261- {
262- foreach ( LocalizationActions . ActionItem item in this . localizationActions
263- . Where ( x => x . TargetType == dependencyObject . GetType ( ) ) )
264- {
265- item . Action ( new LocalizationActions . ActionArguments ( dependencyObject , value ) ) ;
266- }
267- }
268260 private async Task LocalizeDependencyObjects ( )
269261 {
270262 foreach ( DependencyObject dependencyObject in await this . dependencyObjectsReferences . GetDependencyObjects ( ) )
@@ -280,17 +272,46 @@ private void LocalizeDependencyObject(DependencyObject dependencyObject)
280272 {
281273 foreach ( LanguageDictionary . Item item in items )
282274 {
275+ LocalizeDependencyObject ( dependencyObject , item ) ;
276+ }
277+ }
278+ }
279+
280+ private void LocalizeDependencyObject ( DependencyObject dependencyObject , LanguageDictionary . Item item )
281+ {
283282 if ( GetDependencyProperty (
284283 dependencyObject ,
285284 item . DependencyPropertyName ) is DependencyProperty dependencyProperty )
286285 {
287- dependencyObject . SetValue ( dependencyProperty , item . Value ) ;
286+ LocalizeDependencyObjectsWithDependencyProperty ( dependencyObject , dependencyProperty , item . Value ) ;
288287 }
289288 else
290289 {
291290 LocalizeDependencyObjectsWithoutDependencyProperty ( dependencyObject , item . Value ) ;
292291 }
292+ }
293+
294+ private void LocalizeDependencyObjectsWithDependencyProperty ( DependencyObject dependencyObject , DependencyProperty dependencyProperty , string value )
295+ {
296+ if ( dependencyObject
297+ . GetValue ( dependencyProperty ) ?
298+ . GetType ( ) is Type propertyType &&
299+ propertyType . IsEnum is true &&
300+ Enum . TryParse ( propertyType , value , out object ? enumValue ) is true )
301+ {
302+ dependencyObject . SetValue ( dependencyProperty , enumValue ) ;
303+ return ;
304+ }
305+
306+ dependencyObject . SetValue ( dependencyProperty , value ) ;
293307 }
308+
309+ private void LocalizeDependencyObjectsWithoutDependencyProperty ( DependencyObject dependencyObject , string value )
310+ {
311+ foreach ( LocalizationActions . ActionItem item in this . localizationActions
312+ . Where ( x => x . TargetType == dependencyObject . GetType ( ) ) )
313+ {
314+ item . Action ( new LocalizationActions . ActionArguments ( dependencyObject , value ) ) ;
294315 }
295316 }
296317
0 commit comments