Getting Started with .NET MAUI Kanban Board (SfKanban)
29 Jun 202611 minutes to read
This section provides a quick overview for working with Essential® Kanban for .NET MAUI. It is an efficient way to visualize the workflow at each stage along its path to completion.
To get start quickly with our .NET MAUI Kanban Board, you can check the below video.
Prerequisites
Before proceeding, ensure the following are set up:
- Install .NET 9 SDK or later.
- Set up a .NET MAUI environment with Visual Studio 2022 v17.12 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® MAUI Kanban NuGet package
- In Solution Explorer, right-click the project and choose Manage NuGet Packages.
- Search for Syncfusion.Maui.Kanban and install the latest version.
- Ensure the necessary dependencies are installed correctly, and the project is restored.
Prerequisites
Before proceeding, ensure the following are set up:
- Install .NET 9 SDK or later.
- Set up a .NET MAUI environment with Visual Studio Code.
- Ensure that the .NET MAUI workloads are 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 press 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® MAUI Kanban 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.Kanbanto install the Syncfusion® .NET MAUI Kanban package. - To ensure all dependencies are installed, run
dotnet restore.
Prerequisites
Before proceeding, ensure the following are set up:
- Install .NET 9 SDK or later.
- Set up a .NET MAUI environment with JetBrains Rider 2024.3 or later.
- 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 Kanban NuGet package
- In Solution Explorer, right-click the project and choose Manage NuGet Packages.
- Search for Syncfusion.Maui.Kanban 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 Syncfusion handler
Make sure to add the namespace.
using Syncfusion.Maui.Core.Hosting;Register the Syncfusion core handler in your CreateMauiApp method of MauiProgram.cs file to use Syncfusion controls.
builder.ConfigureSyncfusionCore();Step 4: Import the Kanban namespace
Add the following namespace in your XAML or C#.
xmlns:kanban="clr-namespace:Syncfusion.Maui.Kanban;assembly=Syncfusion.Maui.Kanban"using Syncfusion.Maui.Kanban;Step 5: Populate .NET MAUI Kanban item source
Initialize the .NET MAUI SfKanban control and populate its ItemsSource by creating and binding task data models.
Creating the default model tasks
-
Define the View Model: Create a view model class to set values for the properties listed in the
KanbanModelclass as shown in the following example code. EachKanbanModelinstance represents a card in Kanban control. -
Bind item source for Kanban: To populate the Kanban card items, utilize the
ItemsSourceproperty ofSfKanban. -
Defining columns in the Kanban Board: The columns are generated automatically based on the different values of
Categoryin theKanbanModelclass fromItemsSource. However, you can manually define the columns by setting theAutoGenerateColumnsproperty tofalseand addingKanbanColumninstances to theColumnsproperty ofSfKanban. Define the categories of column using theCategoriesproperty ofKanbanColumn, and cards will be added to the respective columns.
The following sample code demonstrates this process in action:
<kanban:SfKanban x:Name="kanban"
AutoGenerateColumns="False"
ItemsSource="{Binding Cards}">
<kanban:SfKanban.Columns>
<kanban:KanbanColumn Title="To Do"
Categories="Open">
</kanban:KanbanColumn>
<kanban:KanbanColumn Title="In Progress"
Categories="In Progress">
</kanban:KanbanColumn>
<kanban:KanbanColumn Title="Code Review"
Categories="Code Review">
</kanban:KanbanColumn>
<kanban:KanbanColumn Title="Done"
Categories="Done">
</kanban:KanbanColumn>
</kanban:SfKanban.Columns>
<kanban:SfKanban.BindingContext>
<local:KanbanViewModel />
</kanban:SfKanban.BindingContext>
</kanban:SfKanban>SfKanban kanban = new SfKanban();
KanbanViewModel viewModel = new KanbanViewModel();
kanban.AutoGenerateColumns = false;
kanban.Columns.Add(new KanbanColumn
{
Title = "To Do",
Categories = new List<object>() { "Open" },
});
kanban.Columns.Add(new KanbanColumn
{
Title = "In Progress",
Categories = new List<object>() { "In Progress" },
});
kanban.Columns.Add(new KanbanColumn
{
Title = "Code Review",
Categories = new List<object>() { "Code Review" },
});
kanban.Columns.Add(new KanbanColumn
{
Title = "Done",
Categories = new List<object>() { "Done" },
});
kanban.ItemsSource = viewModel.Cards;public class KanbanViewModel
{
public ObservableCollection<KanbanModel> Cards { get; set; }
public KanbanViewModel()
{
this.Cards = new ObservableCollection<KanbanModel>();
this.Cards.Add(new KanbanModel()
{
ID = 1,
Title = "iOS - 1002",
Category = "Open",
Description = "Analyze customer requirements",
IndicatorFill = Colors.Red,
Tags = new List<string> { "Incident", "Customer" }
});
this.Cards.Add(new KanbanModel()
{
ID = 6,
Title = "Xamarin - 4576",
Category = "Open",
Description = "Show the retrieved data from the server in grid control",
IndicatorFill = Colors.Green,
Tags = new List<string> { "Story", "Customer" }
});
this.Cards.Add(new KanbanModel()
{
ID = 13,
Title = "UWP - 13",
Category = "In Progress",
Description = "Add responsive support to application",
IndicatorFill = Colors.Brown,
Tags = new List<string> { "Story", "Customer" }
});
this.Cards.Add(new KanbanModel()
{
ID = 2543,
Title = "IOS- 11",
Category = "Code Review",
Description = "Check login page validation",
IndicatorFill = Colors.Brown,
Tags = new List<string> { "Story", "Customer" }
});
this.Cards.Add(new KanbanModel()
{
ID = 123,
Title = "UWP-21",
Category = "Done",
Description = "Check login page validation",
IndicatorFill = Colors.Brown,
Tags = new List<string> { "Story", "Customer" }
});
}
}
You can download the Kanban Board Getting Started sample from GitHub.