Я применил светлую тему и темную тему для приложения Xamarin через словарь ресурсов.
вот мои образцы ресурсов
Светлая тема:
<ResourceDictionary xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="App.Views.Themes.LightTheme"
xmlns:converters="clr-namespace:App.Services.Helper;assembly=App.Services">
<!-- bootm bar background color -->
<Color x:Key="BottomBar">#17a7a7</Color>
</ResourceDictionary>
Темная тема:
<ResourceDictionary xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="App.Views.Themes.DarkTheme"
xmlns:converters="clr-namespace:App.Services.Helper;assembly=App.Services">
<!-- bootm bar background color -->
<Color x:Key="BottomBar">#292a2a</Color>
</ResourceDictionary>
Обе темы работают нормально, но мне нужно изменить только цвет нижней панели в соответствии с уровнем пользователя. Это только для светлой темы.
Условие:
if(memeberlevel =="Basic"){
//need to change bottom bar color as green
}
else if(memeberlevel =="Intermediate")
{
//need to change bottom bar color as silver
}
else
{
//need to change bottom bar color as gold
}
Как я применяю это условие внутри словаря ресурсов темы Light для
<Color x:Key="BottomBar">#17a7a7</Color>
Здесь мне нужно установить зеленый, серебряный и золотой для x: Key = "BottomBar" в соответствии с уровнем пользователя
Благодарю за быструю помощь. Заранее спасибо