How to use Dark Theme Light Theme in Xamarin Forms?

Viewed 858

I am new to Xamarin Forms, I want to use a logo that changes based on the device mode, if it's dark mode, the logo will be white and if it's light mode, the logo will be black. I only found examples on how to do it for colors by adding them to the resource dictionaries(the example is attached below), I tried to do it for the logo, but It didn't work.Can someone share tips or a link of a tutorial that show how to do that?

<ResourceDictionary
    x:Class="OpsMobile.Styles.DarkTheme"
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    Source="Global.xaml">
    <!--  Colours  -->
    <!--<Color x:Key="MainPage">#F58220</Color>-->
</ResourceDictionary>

<ResourceDictionary
    x:Class="OpsMobile.Styles.LightTheme"
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    Source="Global.xaml">

    <!--  Colours  -->
    <!--<Color x:Key="MainPage">#F58220</Color>-->
</ResourceDictionary>
0 Answers
Related