Forum Xamarin.Forms

Dark Mode

Hello, there is a way to force my app to use light mode? when the iPhone use dark mode some of the controls (entry and navigation bars) turns black and made me interface a little fuzzy.

thx in advance


Best Answer


  • mbrubinsteinmbrubinstein Member ✭✭

    VS2019 Xamarin.Forms latest stable version does not recognize OverrideUserIntrefaceStyle - 'name does not exist in the current context'. Do I miss a reference or is the above code for an experimental Xamarin.Forms (iOS) version?

    The info.plist option works, but is too visible.

    The current Xamarin.Forms SearchBar implementation is unusable in dark mode.

  • LandLuLandLu Member, Xamarin Team Xamurai

    You need to create a custom renderer for Content Page or Navigation Page.
    And change the OverrideUserInterfaceStyle in your iOS project. It is platform related.

  • mbrubinsteinmbrubinstein Member ✭✭

    That is exactly what I did.

    using StreetTrekX.iOS.Renderers;
    using Xamarin.Forms;
    using Xamarin.Forms.Platform.iOS;
    using UIKit;

    [assembly: ExportRenderer(typeof(ContentPage), typeof(DarkModeRenderer))]
    namespace StreetTrekX.iOS.Renderers
    class DarkModeRenderer : PageRenderer

        protected override void OnElementChanged(VisualElementChangedEventArgs e)
            if (e.OldElement != null || Element == null)
             OverrideUserInterfaceStyle = UIUserInterfaceStyle.Light;


    The OverrideUserInterfaceStyle is not recognized - name does not exist.
    The selected iOS Build SDK version 13

  • mbrubinsteinmbrubinstein Member ✭✭

    I am not sure where to look.
    VS2019 Help/About shows iOS SDK version (c669116)

    The SDK version I selected in iOS project/iOS Build is 13.0

    Microsoft Visual Studio Professional 2019
    Version 16.2.5
    Microsoft .NET Framework
    Version 4.8.03752

    Installed Version: Professional

    Xamarin.iOS and Xamarin.Mac SDK (c669116)
    Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

  • LandLuLandLu Member, Xamarin Team Xamurai

    You need to update the Visual Studio to 16.3.0+.
    This version added support for XCode 11 and iOS 13. And then you can consume the entire iOS 13 APIs:

  • mbrubinsteinmbrubinstein Member ✭✭

    Thank you, upgrade to 16.3.1 did it. Normally VS2019 or 2017 alerts when an update becomes available. This time around it did not.
    Works now.

  • FreakyAliFreakyAli USMember ✭✭

    @LandLu Any updates on whether or not there will be an update of Visual Studio 2017 for iOS13?

  • MedFehmiMedFehmi Member ✭✭

    @LandLu thanks for the effort and your help, I used the second option you stated, which is the navigation renderer, but still I would like to ask you, is it possible to publish the app to the apple store using the renderer technique, would it be rejected in that case?

  • luislemaluislema Member ✭✭
    edited January 24

    I tried


    and my application wasn't rejected.

  • dai15002dai15002 Member ✭✭✭

    @luislema said:
    I tried


    and my application wasn't rejected.

    I think it depends on who is reviewing your app. If it happens that someone else starts reviewing your app and notices that, they might then reject your app into store.

Sign In or Register to comment.