Initial Setup for Mac
mainTo develop with the Syncfusion Toolkit for .NET MAUI on macOS, ensure the following prerequisites are met:
- Visual Studio Code: Install VS Code.
- MAUI Extension: Install the .NET MAUI Dev Kit from the VS Code Marketplace.
repository·main·Indexed 20 days ago
https://github.com/syncfusion/maui-toolkitA high-performance collection of UI controls for cross-platform app development on Android, iOS, macOS, and Windows. The toolkit includes controls for data visualization (Cartesian, Circular, and Spark charts), calendars, editors, navigation, layout, buttons, and notifications. It provides the Syncfusion.Maui.Toolkit NuGet package and requires configuration via the .ConfigureSyncfusionToolkit() extension method in MauiProgram.cs.
To develop with the Syncfusion Toolkit for .NET MAUI on macOS, ensure the following prerequisites are met:
To access the toolkit's controls within your XAML files, declare the toolkit namespace using the following URI:
xmlns:toolkit="http://schemas.syncfusion.com/maui/toolkit"
xmlns:toolkit="http://schemas.syncfusion.com/maui/toolkit"You can install the toolkit using the .NET CLI or by manually adding the package reference to your project file.
Using .NET CLI:
dotnet add package Syncfusion.Maui.ToolkitUsing .csproj file: Add the following line to your project file:
<PackageReference Include="Syncfusion.Maui.Toolkit" Version="x.x.x" />Once the build tasks are complete, open the project using your preferred IDE:
Syncfusion.Maui.Toolkit.sln file in Visual Studio.To enable the toolkit in your application, you must call the .ConfigureSyncfusionToolkit() extension method during the app builder initialization in your MauiProgram.cs file. This requires the Syncfusion.Maui.Toolkit.Hosting namespace.
using Syncfusion.Maui.Toolkit.Hosting;
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
// Initialize the Syncfusion .NET MAUI Toolkit
.ConfigureSyncfusionToolkit()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
});
return builder.Build();
}
}To develop with the Syncfusion Toolkit for .NET MAUI on Windows, ensure the following prerequisites are met:
Before opening the solution in an IDE, you must build the build tasks from the command line. Navigate to your cloned repository root and execute the following commands:
cd \repos\maui-toolkit
dotnet tool restore
dotnet build ./Syncfusion.Maui.Toolkit.slnWhen using Syncfusion charts, you must provide a data model and a ViewModel to facilitate data binding.
Person) with properties that correspond to the XBindingPath and YBindingPath used in your XAML series.List<T>) that holds instances of your data model. This collection should be exposed via a public property (e.g., Data) so it can be bound to the chart's ItemsSource.// Person.cs
public class Person
{
public string Name { get; set; }
public double Height { get; set; }
}
// ViewModel.cs
public class ViewModel
{
public List<Person> Data { get; set; }
public ViewModel()
{
Data = new List<Person>()
{
new Person { Name = "David", Height = 170 },
new Person { Name = "Michael", Height = 96 },
new Person { Name = "Steve", Height = 65 },
new Person { Name = "Joel", Height = 182 },
new Person { Name = "Bob", Height = 134 }
};
}
}To visualize data using a Cartesian Chart, you need to set up a SfCartesianChart in XAML, define its axes, and bind a data series to a collection in your ViewModel.
xmlns:chart="clr-namespace:Syncfusion.Maui.Toolkit.Charts;assembly=Syncfusion.Maui.Toolkit" to your XAML file.CategoryAxis for categorical data (e.g., names on the X-axis) and NumericalAxis for continuous data (e.g., values on the Y-axis).ColumnSeries (or other series types) and bind the ItemsSource to your data collection. Specify XBindingPath and YBindingPath to map your model properties to the chart axes.DataLabelSettings and CartesianDataLabelSettings.<ContentPage
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="ChartGettingStarted.MainPage"
xmlns:chart="clr-namespace:Syncfusion.Maui.Toolkit.Charts;assembly=Syncfusion.Maui.Toolkit"
xmlns:model="clr-namespace:ChartGettingStarted">
<ContentPage.BindingContext>
<model:ViewModel/>
</ContentPage.BindingContext>
<chart:SfCartesianChart>
<chart:SfCartesianChart.Title>
<Label Text="Height Comparison" HorizontalOptions="Center" />
</chart:SfCartesianChart.Title>
<chart:SfCartesianChart.Legend>
<chart:ChartLegend />
</chart:SfCartesianChart.Legend>
<chart:SfCartesianChart.XAxes>
<chart:CategoryAxis>
<chart:CategoryAxis.Title>
<chart:ChartAxisTitle Text="Name" />
</chart:CategoryAxis.Title>
</chart:CategoryAxis>
</chart:SfCartesianChart.XAxes>
<chart:SfCartesianChart.YAxes>
<chart:NumericalAxis>
<chart:NumericalAxis.Title>
<chart:ChartAxisTitle Text="Height(in cm)" />
</chart:NumericalAxis.Title>
</chart:NumericalAxis>
</chart:SfCartesianChart.YAxes>
<chart:ColumnSeries Label="Height"
EnableTooltip="True"
ShowDataLabels="True"
ItemsSource="{Binding Data}"
XBindingPath="Name"
YBindingPath="Height">
<chart:ColumnSeries.DataLabelSettings>
<chart:CartesianDataLabelSettings LabelPlacement="Inner" />
</chart:ColumnSeries.DataLabelSettings>
</chart:ColumnSeries>
</chart:SfCartesianChart>
</ContentPage>The toolkit provides a wide range of high-performance UI controls categorized by functionality:
| Category | Controls |
|---|---|
| Data Visualization | Cartesian Charts, Circular Charts, Funnel Charts, Polar Charts, Pyramid Charts, Spark Charts, Sunburst Charts |
| Calendars | Calendar |
| Editors | Date Picker, Date Time Picker, Numeric Entry, Numeric Up Down, OTP Input, Picker, Time Picker |
| Navigation | Bottom Sheet, Navigation Drawer, Tab View |
| Layout | Accordion, Cards, Carousel, Expander, Popup, Text Input Layout |
| Buttons | Button, Chips, Segmented Control |
| Notification | Circular Progress Bar, Linear Progress Bar, Pull to Refresh |
| Miscellaneous | Effects View, Shimmer |
The repository includes sample projects located in the samples directory for testing and demonstration:
├── samples
│ ├── Syncfusion.Maui.ControlsGallery
│ ├── Syncfusion.Maui.Controls.Samples.Sandbox