Updating ResourceDictionary in code behind doesn't fire change notification
See original GitHub issueXAML Version: System XAML Scenario: When doing Hot reload in React Native, some styling needs to change as a response to the user changing app code out from under the app
void SetResources(const xaml::FrameworkElement& fe, const JSValueObject& dict) {
auto rd = ResourceDictionary();
for (auto const& entry : dict) {
const auto& name = entry.first;
const auto& value = entry.second;
auto brush = ColorUtils::SolidColorBrushFrom(value);
rd.Insert(winrt::box_value(winrt::to_hstring(name)), brush);
}
fe.Resources(rd);
}
Running through this code the first time correctly sets the value and it renders. The second time this code runs through, the control does not re-render. Removing the element from the ResourceDictionary does not fix it either
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:7 (7 by maintainers)
Top Results From Across the Web
ResourceDictionary dynamic updating not updating UI in ...
I wish to change the styles (for theming) at runtime. I have the following resource dictionary which I include in my views.
Read more >ResourceDictionary Class (Windows.UI.Xaml) - UWP
Defines a repository for XAML resources, such as styles, that your app uses. You define the resources in XAML and can then retrieve...
Read more >Design View Appearing While Editing XAML Resource ...
After updating Visual Studios to 16.11.6 the Design View is now appearing when I open a XAML resource dictionary file that holds data...
Read more >Static And Dynamic Resources In WPF
Let's go ahead and create a WPF application. Static Resource. It will not change once it's assigned and they are applied at the...
Read more >Create and manage notification channels
After you create a notification channel, you can't change the notification behaviors. The user has complete control at that point. However, you ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Agreed. The developer expectation is that these should be dynamic. WPF had DynamicResource and that doesn’t exist in the StaticResource/ThemeResource system of system XAML and WinUI. It feels like a gap and one we need to resolve in the resource system design eventually.
Internal tracking: http://task.ms/39897009