I've seen a few questions asked around the performance difference in using DynamicResource over StaticResource but it's mainly been around WPF and not Xamarin.Forms mobile apps.
The context of my question is around a specific use-case I've got:
I have an application that only uses StaticResources at the moment but need the ability to have a 'flavour' of the app (determined by an internal build time flag) that is able to change the style/theme at runtime -- the variables to be controlled via an API upon app initialisation.
So I'm currently facing the situation where I would need to change all StaticResource references in the XAML layouts to use DynamicResource. What are the performance implications of this?
Alternatively, would it be possible to write my own markup extension to return if it should use DynamicResource or a StaticResource depending on the internal 'flavour' flag that is currently set? So that way I don't need to ship code that references dynamic resources if the flavour does not require it to do so.
According to offical document Dynamic Styles in Xamarin.Forms:
Edit: The dynamicResources will override the staticresources if they both exist. I did a test about change staticresources into dynamic.
Xmal:
codebehind: