Getting Started with Uno Toolkit
Uno Toolkit Library
The Uno.Toolkit library is available as NuGet packages that can be added to any new or existing Uno solution.
As of Uno 4.7, the solution template of an Uno app has changed. There is no longer a Shared project (.shproj), it has been replaced with a regular cross-platform library containing all user code files, referred to as the App Code Library project. This also implies that package references can be included in a single location without the previous need to include those in all project heads.
This article is a guide for installing the base Uno.Toolkit library, additional steps are needed when installing the Toolkit support libraries for Uno.Material and Uno.Cupertino. Most controls within the base Toolkit library are not designed to be used without an underlying design system installed. After following the installation steps below, refer to the following guides for Material/Cupertino support:
Open an existing Uno project, or create a new Uno project using the
Multi-Platform App (Uno Platform)template.
In the Solution Explorer panel, right-click on your app's App Code Library project (
PROJECT_NAME.csproj) and select
Manage NuGet Packages...
Add the resources to
<ResourceDictionary> <ResourceDictionary.MergedDictionaries> <!-- Load Uno.Toolkit.UI resources --> <ToolkitResources xmlns="using:Uno.Toolkit.UI" /> <!-- Load custom application resources --> <!-- ... --> </ResourceDictionary.MergedDictionaries> </ResourceDictionary>
Previous Installation Method
If your application is based on the older solution template that includes a shared project (.shproj), follow these steps:
Open your existing Uno project
In the Solution Explorer panel, right-click on your solution name and select
Manage NuGet Packages for Solution .... Choose either:
Select the following projects for installation:
PROJECT_NAME.macOS.csprojif you have an existing project)
PROJECT_NAME.UWP.csprojfor existing projects)
Add the resources to
<Application ...> <Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <!-- Load WinUI resources --> <XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" /> <!-- Load Uno.Toolkit.UI resources --> <ToolkitResources xmlns="using:Uno.Toolkit.UI" /> <!-- Load custom application resources --> <!-- ... --> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Application.Resources> </Application>
Using C# Markup
The Toolkit library also has support for C# Markup through a Uno.Toolkit.WinUI.Markup NuGet Package.
To get started with Toolkit in your C# Markup application, add the
Uno.Toolkit.WinUI.Markup NuGet package to your App Code Library project and your platform heads.
Then, add the following code to your
using Uno.Toolkit.UI.Markup; this.Build(r => r.UseToolkit());