- Prerequisites
- Step 1: Create a New .NET MAUI Project
- Step 2: Install the Syncfusion® .NET MAUI Linear ProgressBar NuGet Package
- Step 3: Register the handler
- Step 4: Add .NET MAUI Linear progress bar control
- Enabling indeterminate state
- Enable segments
- Apply colors
Contact Support
Getting started with .NET MAUI Linear ProgressBar
This section explains the steps required to add the linear progress bar control with the progress and its customizable elements such as indeterminate, segment, progress fill, and track fill. This section covers only the basic features needed to know and gets started with the Syncfusion® linear progress bar. Follow the steps below to add a .NET MAUI Linear progress bar control to your project.
To get start quickly with our .NET MAUI Linear ProgressBar, check the following video.
Prerequisites
Before proceeding, ensure the following are set up:
- Install .NET 7 SDK or later is installed.
- Set up a .NET MAUI environment with Visual Studio 2022 (v17.3 or later).
Step 1: Create a New .NET MAUI Project
- Go to File > New > Project and choose the .NET MAUI App template.
- Name the project and choose a location. Then click Next.
- Select the .NET framework version and click Create.
Step 2: Install the Syncfusion® .NET MAUI Linear ProgressBar NuGet Package
- In Solution Explorer, right-click the project and choose Manage NuGet Packages.
- Search for Syncfusion.Maui.ProgressBar and install the latest version.
- Ensure the necessary dependencies are installed correctly, and the project is restored.
Step 3: Register the handler
The Syncfusion.Maui.Core NuGet is a dependent package for all Syncfusion® controls of .NET MAUI. In the MauiProgram.cs file, register the handler for Syncfusion core.
using Syncfusion.Maui.Core.Hosting;
namespace GettingStarted
{
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder.ConfigureSyncfusionCore();
builder
.UseMauiApp<App>()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
});
return builder.Build();
}
}
}
Step 4: Add .NET MAUI Linear progress bar control
- To initialize the control, import the
Syncfusion.Maui.ProgressBar
namespace into your code. - Initialize SfLinearProgressBar.
xmlns:progressBar="clr-namespace:Syncfusion.Maui.ProgressBar;assembly=Syncfusion.Maui.ProgressBar"
using Syncfusion.Maui.ProgressBar;
Create an instance for the linear progress bar control, and add it as content.
<progressBar:SfLinearProgressBar Progress="75"/>
SfLinearProgressBar linearProgressBar = new SfLinearProgressBar { Progress = 75 };
this.Content = linearProgressBar;
Prerequisites
Before proceeding, ensure the following are set up:
- Install .NET 7 SDK or later is installed.
- Set up a .NET MAUI environment with Visual Studio Code.
- Ensure that the .NET MAUI workload is installed and configured as described here.
Step 1: Create a New .NET MAUI Project
- Open the command palette by pressing
Ctrl+Shift+P
and type .NET:New Project and enter. - Choose the .NET MAUI App template.
- Select the project location, type the project name and press Enter.
- Then choose Create project.
Step 2: Install the Syncfusion® .NET MAUI Linear ProgressBar NuGet Package
- Press Ctrl + ` (backtick) to open the integrated terminal in Visual Studio Code.
- Ensure you’re in the project root directory where your .csproj file is located.
- Run the command
dotnet add package Syncfusion.Maui.ProgressBar
to install the Syncfusion® .NET MAUI ProgressBar NuGet package. - To ensure all dependencies are installed, run
dotnet restore
.
Step 3: Register the handler
The Syncfusion.Maui.Core NuGet is a dependent package for all Syncfusion® controls of .NET MAUI. In the MauiProgram.cs file, register the handler for Syncfusion core.
using Syncfusion.Maui.Core.Hosting;
namespace GettingStarted
{
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder.ConfigureSyncfusionCore();
builder
.UseMauiApp<App>()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
});
return builder.Build();
}
}
}
Step 4: Add .NET MAUI Linear progress bar control
- To initialize the control, import the
Syncfusion.Maui.ProgressBar
namespace into your code. - Initialize SfLinearProgressBar.
xmlns:progressBar="clr-namespace:Syncfusion.Maui.ProgressBar;assembly=Syncfusion.Maui.ProgressBar"
using Syncfusion.Maui.ProgressBar;
Create an instance for the linear progress bar control, and add it as content.
<progressBar:SfLinearProgressBar Progress="75"/>
SfLinearProgressBar linearProgressBar = new SfLinearProgressBar { Progress = 75 };
this.Content = linearProgressBar;
Prerequisites
Before proceeding, ensure the following are set up:
- Ensure you have the latest version of JetBrains Rider.
- Install .NET 8 SDK or later is installed.
- Make sure the MAUI workloads are installed and configured as described here.
Step 1: Create a new .NET MAUI Project
- Go to File > New Solution, Select .NET (C#) and choose the .NET MAUI App template.
- Enter the Project Name, Solution Name, and Location.
- Select the .NET framework version and click Create.
Step 2: Install the Syncfusion® MAUI ProgressBar NuGet Package
- In Solution Explorer, right-click the project and choose Manage NuGet Packages.
- Search for Syncfusion.Maui.ProgressBar and install the latest version.
- 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 handler
The Syncfusion.Maui.Core NuGet is a dependent package for all Syncfusion® controls of .NET MAUI. In the MauiProgram.cs file, register the handler for Syncfusion core.
using Syncfusion.Maui.Core.Hosting;
namespace GettingStarted
{
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder.ConfigureSyncfusionCore();
builder
.UseMauiApp<App>()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
});
return builder.Build();
}
}
}
Step 4: Add .NET MAUI Linear progress bar control
- To initialize the control, import the
Syncfusion.Maui.ProgressBar
namespace into your code. - Initialize SfLinearProgressBar.
xmlns:progressBar="clr-namespace:Syncfusion.Maui.ProgressBar;assembly=Syncfusion.Maui.ProgressBar"
using Syncfusion.Maui.ProgressBar;
Create an instance for the linear progress bar control, and add it as content.
<progressBar:SfLinearProgressBar Progress="75"/>
SfLinearProgressBar linearProgressBar = new SfLinearProgressBar { Progress = 75 };
this.Content = linearProgressBar;
NOTE
By default, the value of progress should be specified between 0 and 100. To determine the progress value between 0 and 1, set the Minimum property to 0 and the Maximum property to 1.
Run the project, and check if you get following output to make sure that the project has been configured properly to add the linear progress bar.
Enabling indeterminate state
When the progress of a task cannot be shown determinately, you can enable the indeterminate state using the IsIndeterminate
property to know if any progress is happening in the background.
<progressBar:SfLinearProgressBar IsIndeterminate="True"/>
SfLinearProgressBar linearProgressBar = new SfLinearProgressBar { IsIndeterminate = true };
this.Content = linearProgressBar;
Enable segments
To visualize the progress of a multiple sequential task, split the linear progress bar into the multiple segments by defining the SegmentCount
property as demonstrated in the following code sample.
<progressBar:SfLinearProgressBar SegmentCount="4" Progress="75"/>
SfLinearProgressBar linearProgressBar = new SfLinearProgressBar { Progress = 75, SegmentCount = 4 };
this.Content = linearProgressBar;
Apply colors
Customize the color of the progress indicator and track by defining the ProgressFill
and TrackFill
properties, respectively.
<progressBar:SfLinearProgressBar Progress="75"
TrackFill="#33ffbe06"
ProgressFill="#FFffbe06"/>
<progressBar:SfLinearProgressBar Progress="75"
TrackFill="#3351483a"
ProgressFill="#FF51483a"/>
SfLinearProgressBar linearProgressBar = new SfLinearProgressBar
{
Progress = 75,
TrackFill = new SolidColorBrush(Color.FromArgb("#33ffbe06")),
ProgressFill = new SolidColorBrush(Color.FromArgb("#FFffbe06"))
};
SfLinearProgressBar sfLinearProgressBar = new SfLinearProgressBar
{
Progress = 75,
TrackFill = new SolidColorBrush(Color.FromArgb("#3351483a")),
ProgressFill = new SolidColorBrush(Color.FromArgb("#FF51483a"))
};
NOTE
- Get the complete getting started sample from GitHub link.
- Refer to our .NET MAUI Linear ProgressBar feature tour page for its groundbreaking feature representations.