Getting started with .NET MAUI Time Picker

21 Jul 20265 minutes to read

This section explains how to add the .NET MAUI Time Picker control. It covers only the basic features needed to get started with the Syncfusion® Time Picker. Follow the steps below to add a .NET MAUI Time Picker to your project.

To get started quickly with our .NET MAUI Time Picker, see the video below.

Prerequisites

Before proceeding, ensure the following are set up:

  1. Install .NET 9 SDK or later.
  2. Set up a .NET MAUI environment with Visual Studio 2022 v17.12 or later.

Step 1: Create a new .NET MAUI project

  1. Go to File > New > Project and choose the .NET MAUI App template.
  2. Name the project and choose a location. Then click Next.
  3. Select the .NET framework version and click Create.

Step 2: Install the Syncfusion® .NET MAUI Picker NuGet package

  1. In Solution Explorer, right-click the project and choose Manage NuGet Packages.
  2. Search for Syncfusion.Maui.Picker and install the latest version.
  3. Ensure the necessary dependencies are installed correctly, and the project is restored.

Prerequisites

Before proceeding, ensure the following are set up:

  1. Install .NET 9 SDK or later.
  2. Set up a .NET MAUI environment with Visual Studio Code.
  3. Ensure that the .NET MAUI workloads are installed and configured as described here.

Step 1: Create a new .NET MAUI project

  1. Open the command palette by pressing Ctrl+Shift+P and type .NET:New Project and press Enter.
  2. Choose the .NET MAUI App template.
  3. Select the project location, type the project name, and press Enter.
  4. Then choose Create project.

Step 2: Install the Syncfusion® .NET MAUI Picker NuGet package

  1. Press Ctrl + ` (backtick) to open the integrated terminal in Visual Studio Code.
  2. Ensure you are in the project root directory where your .csproj file is located.
  3. Run dotnet add package Syncfusion.Maui.Picker to install the Syncfusion® .NET MAUI Picker NuGet package.
  4. To ensure all dependencies are installed, run dotnet restore.

Prerequisites

Before proceeding, ensure the following are set up:

  1. Install .NET 9 SDK or later.
  2. Set up a .NET MAUI environment with JetBrains Rider 2024.3 or later.
  3. Make sure the MAUI workloads are installed and configured as described here.

Step 1: Create a new .NET MAUI project

  1. Go to File > New Solution, select .NET (C#) and choose the .NET MAUI App template.
  2. Enter the Project Name, Solution Name, and Location.
  3. Select the .NET framework version and click Create.

Step 2: Install the Syncfusion® MAUI Picker NuGet package

  1. In Solution Explorer, right-click the project and choose Manage NuGet Packages.
  2. Search for Syncfusion.Maui.Picker and install the latest version.
  3. Ensure the necessary dependencies are installed correctly, and the project is restored. If not, Open the Terminal in Rider and manually run: dotnet restore

Step 3: Register the Syncfusion® core handler

Add the following namespace at the top of MauiProgram.cs.

using Syncfusion.Maui.Core.Hosting;

Register the Syncfusion® core handler in the CreateMauiApp method of MauiProgram.cs.

builder.ConfigureSyncfusionCore();

Step 4: Import the Time Picker namespace

Add the following namespace in your XAML or C# code.

xmlns:picker="clr-namespace:Syncfusion.Maui.Picker;assembly=Syncfusion.Maui.Picker"
using Syncfusion.Maui.Picker;

Step 5: Add the Time Picker component

Initialize the SfTimePicker control and configure its properties. The SfTimePicker allows you to add header text by setting the Text property in the PickerHeaderView. Enable the header view by setting the Height property of the PickerHeaderView to a value greater than 0.

<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:picker="clr-namespace:Syncfusion.Maui.Picker;assembly=Syncfusion.Maui.Picker">
    <picker:SfTimePicker x:Name="picker">
        <picker:SfTimePicker.HeaderView>
            <picker:PickerHeaderView Text="Time Picker" Height="40" />
        </picker:SfTimePicker.HeaderView>
    </picker:SfTimePicker>
</ContentPage>
using Syncfusion.Maui.Picker;
. . .

SfTimePicker picker = new SfTimePicker();
picker.HeaderView = new PickerHeaderView()
{
    Text = "Time Picker",
    Height = 40,
};

this.Content = picker;

Set header view in .NET MAUI Time Picker.

Verify installation

Run dotnet build and confirm the project compiles without errors. If you see a TypeInitializationException referencing SfTimePicker, verify that both Syncfusion.Maui.Picker and Syncfusion.Maui.Core are installed and that builder.ConfigureSyncfusionCore(); is called in MauiProgram.cs.

You can download the Time Picker Getting Started sample from GitHub.