xamarin/Xamarin.Forms

[Bug] Label TextColor DynamicResource does not update after DataTrigger applies TextColor

Offen

#6.864 geöffnet am 13.07.2019

 (3 Kommentare) (0 Reaktionen) (1 zugewiesene Person)C# (1.926 Forks)batch import
a/stylee/3 :clock3:help wantedt/bug :bug:up-for-grabs

Repository-Metriken

Stars
 (5.644 Sterne)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

Description

@PureWeen - We discussed this issue today at XamDevSummit and as you requested, I reduced it down to a more manageable code example.

I have a Label with TextColor set to a DynamicResource themeTextColor. I also have a DataTrigger added to the Label that will change the TextColor to Red. Switching between my Default and Dark theme works until I enter the condition specified by the DataTrigger. Afterwards, Switching between Default and Dark has no effect.

In my particular case, I am looking up the Color resource in the ResourceDictionary by key and changing the value. This is opposed to replacing the entire ResourceDictionary.

Steps to Reproduce

(see example project)

  1. Switch between Default and Dark a couple of times
  2. Observe DynamicResources DO update
  3. Switch "Triggered" on and off
  4. Attempt to Switch theme
  5. Observe Label TextColor doesn't change

Expected Behavior

Label updates TextColor to theme's themeTextColor

Actual Behavior

Label is stuck on themeTextColor when triggered

Repro Project Link

https://github.com/ChaseMarsh/My.Xamarin.Issues/tree/master/DynamicResouceTriggerIssue

Contributor Guide