How to use Uno.Cupertino

This guide will walk you through the necessary steps to set up and use the Uno.Cupertino package in an Uno Platform application.


The complete source code that goes along with this guide is available in the unoplatform/Uno.Samples GitHub repository - UnoCupertinoSample


For a step-by-step guide to installing the prerequisites for your preferred IDE and environment, consult the Get Started guide.


Section 1: Setup Uno.Cupertino

  1. Create a new Uno Platform application, following the instructions here.

  2. Add NuGet package Uno.Cupertino to each of project heads:


    The project heads refer to the projects targeted to a specific platforms:

    • UnoCupertinoSample.Droid
    • UnoCupertinoSample.iOS
    • UnoCupertinoSample.macOS
    • UnoCupertinoSample.Skia.Gtk
    • UnoCupertinoSample.Skia.Tizen
    • UnoCupertinoSample.Skia.WPF
    • UnoCupertinoSample.UWP
    • UnoCupertinoSample.Wasm

    The shared project is not part of this, and the .Skia.WPF.Host project is another exception.

    Here are some issues that you are likely to run into after complete the above step:

    • NU1605: Detected package downgrade: Uno.UI from 3.6.0-dev.275 to 3.5.1. Reference the package directly from the project to select a different version.

      The app may not compile, crash at runtime, or behave strangely as a result of this. solution: You need to update the version of Uno.WinUI (or Uno.UI) packages for all project heads that you are using to the higher version.

      note: By Uno.WinUI packages, it includes:

      • Uno.WinUI
      • Uno.WinUI.RemoteControl
      • Uno.WinUI.WebAssembly
      • Uno.WinUI.Skia.Gtk
      • Uno.WinUI.Skia.Tizen
      • Uno.WinUI.Skia.Wpf
    • When building the .Droid project, the project failed to build with:

      error : Could not find 1 Android X assemblies, make sure to install the following NuGet packages:
          - Xamarin.AndroidX.Lifecycle.LiveData
      You can also copy-and-paste the following snippet into your .csproj file:
          <PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData" Version="2.1.0" />

      solution: Add the mentioned version of Xamarin.AndroidX.Lifecycle.LiveData to the .Droid project

  3. Add the following code inside App.xaml:

                <!-- Load WinUI resources -->
                <XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
                <CupertinoColors xmlns="using:Uno.Cupertino"  />
                <CupertinoResources xmlns="using:Uno.Cupertino" />
                <!-- Application's custom styles -->
                <!-- other ResourceDictionaries -->

Section 2: Using Uno.Cupertino library

  1. Let's add a few controls with the Cupertino style to MainPage.xaml:
    <Page x:Class="UnoCupertinoSample.MainPage"
        <Grid toolkit:VisibleBoundsPadding.PaddingMask="Top" >
                <StackPanel Margin="16,0" Spacing="8">
                    <!-- controls with Cupertino styles -->
                    <TextBlock Text="Hello, Cupertino!" Style="{StaticResource CupertinoPrimaryTitle}" />
                    <TextBlock Text="text" Style="{StaticResource CupertinoBody}" />
                    <Button Content="button" Style="{StaticResource CupertinoButtonStyle}" />
                    <ComboBox ItemsSource="asd" Style="{StaticResource CupertinoComboBoxStyle}" />
                    <DatePicker Style="{StaticResource CupertinoDatePickerStyle}" />
                    <TextBox Text="input" Style="{StaticResource CupertinoTextBoxStyle}" />

You can find the style names using these methods:

  • "Feature" section of Uno.Themes README here
  • Going through the source code of control styles
  • Check out the Uno.Gallery web app (Click on the <> button to view xaml source)

Section 3: Overriding Color Palette

  1. Create the nested folders Styles\ and then Styles\Application\ under the .Shared project

  2. Add a new Resource Dictionary ColorPaletteOverride.xaml under Styles\Application\

  3. Replace the content of that ResourceDictionary with the source from here

  4. Make a few changes to the colors:

    Here we are replacing the last 2 characters with 00, essentially dropping the blue-channel

    <!-- Light Theme -->
    <ResourceDictionary x:Key="Light">
        <Color x:Key="CupertinoBlueColor">#007B00</Color>
        <!-- ... -->
    <!-- Dark Theme -->
    <ResourceDictionary x:Key="Dark">
        <Color x:Key="CupertinoBlueColor">#007B00</Color>
        <!-- ... -->
    <!-- ... -->
  5. In App.xaml, update the line that initializes the CupertinoColors to include the new palette override:

     			<!-- ... -->
                <CupertinoColors xmlns="using:Uno.Cupertino" 
                                 OverrideSource="ms-appx:///Styles/Application/ColorPaletteOverride.xaml" />
     			<CupertinoResources xmlns="using:Uno.Cupertino" />
     			<!-- ... -->
  6. Run the app, you should now see the controls using your new color scheme.

Section 4: Fonts

By default, Uno.Cupertino will attempt to apply a FontFamily with a name of SF Pro to its controls. This FontFamily resource is given the key CupertinoFontFamily. If there is no FontFamily with name SF Pro loaded into your application, the default system font will be used. You can override this default behavior by providing an OverrideSource to the <CupertinoFonts /> initialization within your App.xaml.

  1. Install your custom font following the steps here
  2. Create the nested folders Styles\ and then Styles\Application\ under the .Shared project
  3. Add a new Resource Dictionary CupertinoFontsOverride.xaml under Styles\Application\
  4. Add your custom font with the resource key CupertinoFontFamily:
    <ResourceDictionary xmlns=""
        <FontFamily x:Key="CupertinoFontFamily">ms-appx:///Assets/Fonts/Material/RobotoMono-VariableFont_wght.ttf#Roboto Mono</FontFamily>
  5. In App.xaml, add the line that initializes the CupertinoFonts to include the new font override:
            <!-- ... -->
            <!-- Load Cupertino Font with OverrideSource -->
            <CupertinoFonts xmlns="using:Uno.Cupertino"
                        OverrideSource="ms-appx:///Styles/Application/CupertinoFontsOverride.xaml" />
            <!-- Load the Cupertino control resources -->
            <CupertinoResources xmlns="using:Uno.Cupertino" />
            <!-- ... -->
  6. Run the app, you should now see the controls using your new FontFamily.

Get the complete code

See the completed sample on GitHub: UnoCupertinoSample

Additional Resources

Help! I'm having trouble


If you ran into difficulties with any part of this guide, you can: