0

In my Xamarin project (Xamarin 4.8) there are many pages with complex structure. Also there are many bitmap resources, designed for white backgrounds etc.

When user sets Dark theme on the iOS, appearance of pages become weird and unusable. On Android the application looks as nothing was changed.

For now I have no time, to set manually color properties on every control on every page and I would like to enforce light theme for the application (Android and iOS platforms), to get a time to redesign the whole application later.

In an article I read that Xamarin 5 offers a way, putting this line of code into Application class:

App.Current.UserAppTheme = OSAppTheme.Light;

I tried this way (migrated project to Xamarin 5 and called this code), but it does not work. Application on iOS in the Dark theme looks unusable.

What options do I have on this point? Is there a relatively simple way to enforce Light theme for iOS applications?

Rafael
  • 1,281
  • 2
  • 10
  • 35

1 Answers1

0

As advised by @SushiHangover and @JackHua-MSFT into this answer I used the following approach and it worked (XCode 12.3):

Into the plist.info I should add the key UIUserInterfaceStyle with value Light. And that enforces Light theme for the application, regardless of what theme is set for the device.

Final xml code, that I added to plist.info looks like that:

<key>UIUserInterfaceStyle</key>
<string>Light</string>
Rafael
  • 1,281
  • 2
  • 10
  • 35