Search code examples
c#xamlmauiapp-themes

Theme doesn't change correctly in maui for elements with no background when the system theme is black


When changing the theme of the OS, the application normally does not display all entries. I tried to change the background of the entry, but then the frames are not visible on iOS, and if it is empty (without a placeholder), then it will be extremely difficult to find it. Added Application.Current.UserAppTheme = AppTheme.Light to the App.xaml.cs file.

Screenshot.

The problem is present on both iOS and Android.


Solution

  • As it turned out, the problem is that I use a custom entry in which I do not specify a background color, after setting it to Transparent, the entry is displayed normally, except that there is no frame around (ios) and underlining (android). So far I just wrapped the record in a border and it works.

    I'll leave the question open for now, maybe someone will find a more elegant solution to the problem

    Update: I stumbled upon this article and after trying this method, I no longer met the dark theme https://learn.microsoft.com/en-us/answers/questions/231994/disable-dark-mode-in-xamarin-forms-4-8