Skip to content

Commit

Permalink
fix: Ensure ThemeResource bindings are properly updated when style is…
Browse files Browse the repository at this point in the history
… applied
  • Loading branch information
MartinZikmund committed Jul 26, 2023
1 parent 38d2786 commit 7d69690
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Uno.UI/UI/Xaml/Style/Style.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ internal void ApplyTo(DependencyObject o, DependencyPropertyValuePrecedences pre
return;
}

var localPrecedenceDisposable = DependencyObjectExtensions.OverrideLocalPrecedence(o, precedence);
IDisposable? localPrecedenceDisposable = DependencyObjectExtensions.OverrideLocalPrecedence(o, precedence);

EnsureSetterMap();

Expand All @@ -91,15 +91,17 @@ internal void ApplyTo(DependencyObject o, DependencyPropertyValuePrecedences pre
}
}

localPrecedenceDisposable?.Dispose();

// Check tree for resource binding values, since some Setters may have set ThemeResource-backed values
(o as IDependencyObjectStoreProvider)!.Store.UpdateResourceBindings(ResourceUpdateReason.StaticResourceLoading);
(o as IDependencyObjectStoreProvider)!.Store.UpdateResourceBindings(ResourceUpdateReason.ResolvedOnLoading);
}
#if !HAS_EXPENSIVE_TRYFINALLY
finally
#endif
{
ResourceResolver.PopScope();
localPrecedenceDisposable?.Dispose();
ResourceResolver.PopScope();
}
}

Expand Down

0 comments on commit 7d69690

Please sign in to comment.