"> I was reading this blog, where the author discusses how to toggle between a light and Dark theme. By using DynamicResource Bindings:
https://blog.xamarin.com/easy-app-theming-with-xamarin-forms-styles/
I was able to get a basic App.Xaml setup in my project and toggle the background color:
The code is given below:-
<?xml version="1.0" encoding="UTF-8"?>
<Application xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="SomeApp.App">
<Application.Resources>
<ResourceDictionary>
<Color x:Key="backgroundColor">#33302E</Color>
<Color x:Key="textColor">White</Color>
<Style x:Key="labelStyle" TargetType="Label">
<Setter Property="TextColor" Value="{DynamicResource textColor}" />
</Style>
<Style x:Key="backgroundStyle" TargetType="VisualElement">
<Setter Property="BackgroundColor" Value="{DynamicResource backgroundColor}" />
</Style>
</ResourceDictionary>
</Application.Resources>
</Application>
I am trying to include the following to be associated with the same x:Key = "backgroundStyle" instead of in backgroundStyle2
<Thickness x:Key="Padding_StandardPage">30</Thickness> <Style x:Key="backgroundStyle2" TargetType="Page"> <Setter Property="Padding" Value="{DynamicResource Padding_StandardPage}" /> </Style>
The reason being I want to use the same key that can associate with Multiple values at a page wide level like this:
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:styling="SomeApp.Styling;assembly=RecoveryConnect_Mobile_PCL"
x:Class=SomeAppL.Views.Menus.Page_MainMenu"Title="Main Menu" Style="{DynamicResource backgroundStyle}">
> >
Can someone help me out with this. There are not many examples or documentations for me to refer to as far as dynmaic resouce styling goes, expecially by combining mutliple style settings and associatign them with the same Key, (if such a thing were even possible)