Search code examples
xamarin.formsthemesdatatemplateresourcedictionary

Why styles are not updated dynamically inside DataTemplate on Xamarin UWP


I am facing an issue where control styles are never updated dynamically when they are especially located in a DataTemplate on UWP. It is actually working on Android.

What I am trying to achieve here is to understand how to update the theme of an app by switching between two themes : Light and Dark. I found out that dynamic resources and merged dictionaries can be used for this purpose.

Here's a link to the sources : Git

Styles are applied correctly when the page is created but are not updated dynamically when the app theme changes. I use a CollectionView to display the theme options providing a custom ContentView (CheckBoxView) to the CollectionView.ItemTemplate. The user can pick a theme and it should update every controls including the ones created using DataTemplate.

Here's what it looks like : observed

And here's what I expect it to do : expected

Does anyone can explain this behavior ? What am I missing here ?

Regards

EDIT : Added gif instead of images


Solution

  • I solved this issue by updating Xamarin.Forms from v4.2.0.709249 to its last stable version (currently v4.4.0.991537).