I have a drop down in my xamarin forms application where i have option to change the theme of whole app (color of button, background color of the app, and etc). I know about the control template but we can't not change presenter 's component(label, textbox, button) color or theme. HOw to change theme of whole application by just selecting from the drop down.?
Posts
I don't think it's easy to do that. Maybe we can pre-define a theme class whose property is a set of colors(or other resources) for this theme. When we want to set a button's background color, instead of using a certain value use the property of current theme class. Then we can change the app's "theme" via several different theme class instances.
When we have changed the theme class, the existed page's controls should be refreshed. This refresh method should be considered at construct time.
@VIVEKNEGI
There is a rather "simple" way of doing that for as Outlined in this document https://docs.microsoft.com/en-us/xamarin/android/user-interface/material-theme. Basically the approach that @LandLu suggested. I don't really know about the other platforms though
I've been meaning to add the attached article to my tutorial series- but I haven't gotten around to it. It might help with your styling and theming work.
I didn't find any solution yet.
Did you try the entire tutorial with code that I supplied just one post above? The 4 other people that read it came back and told me it was awesome and helped them "so much".
You might want check this article about dynamic resource out: https://blog.xamarin.com/easy-app-theming-with-xamarin-forms-styles/