Skip to content

Updating ResourceDictionary in code behind doesn't fire change notification #4443

@asklar

Description

@asklar

XAML 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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions