Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Telerik single proj Migration #2354

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 52 additions & 13 deletions doc/Learn/Maui/ThirdParty-Telerik.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,64 @@ The controls in the Telerik UI for .NET MAUI can be used in an Uno Platform appl

An existing sample app that showcases the controls is available [here](https://github.com/unoplatform/Uno.Samples/tree/master/UI/MauiEmbedding/TelerikApp).

> [!NOTE]
> Telerik SDK for .NET is currently only compatible with Windows, Android, iOS, and Mac Catalyst when used with Uno Platform at the moment.

## Installation

In order to use the Telerik controls, you first need to create an account and order a license to use the controls. You can find more instructions [here](https://www.telerik.com/). Then follow the instructions to have access to the private NuGet feed.

## Getting Started

1. Create a new application using the `unoapp` template, enabling .NET MAUI Embedding. In this case, we're going to use the Blank template (`-preset blank`) and include .NET MAUI Embedding support (`-maui`).
### [Visual Studio](#tab/vs)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


```dotnetcli
dotnet new unoapp -preset blank -maui -o MauiEmbeddingApp
```
> [!NOTE]
> If you don't have the **Uno Platform Extension for Visual Studio** installed, follow [these instructions](xref:Uno.GetStarted.vs2022).
- Launch **Visual Studio** and click on **Create new project** on the Start Window. Alternatively, if you're already in Visual Studio, click **New, Project** from the **File** menu.

- Type `Uno Platform` in the search box

- Click **Uno Platform App**, then **Next**

- Name the project `TelerikApp` and click **Create**

At this point you'll enter the **Uno Platform Template Wizard**, giving you options to customize the generated application.

- Select **Blank** in **Presets** selection

- Select the **Platforms** tab and unselect **Desktop** and **Web Assembly** platforms

- Select the **Features** tab and click on **.NET MAUI Embedding**

- Click **Create** to complete the wizard

1. Next, add a reference to the `Telerik.UI.for.Maui` NuGet package to the `MauiEmbeddingApp.MauiControls` project.
The template will create a solution with a single cross-platform project, named `TelerikApp`, ready to run.

1. In the `AppBuilderExtensions` class, on `MauiEmbeddingApp.MauiControls` project, update the `UseMauiControls` extension method to call the `UseTelerik` method.
For more information on all the template options, see [Using the Uno Platform Template](xref:Uno.GettingStarted.UsingWizard).

### [Command Line](#tab/cli)

> [!NOTE]
> If you don't have the **Uno Platform dotnet new templates** installed, follow [dotnet new templates for Uno Platform](xref:Uno.GetStarted.dotnet-new).
Create a new application using the `unoapp` template, enabling .NET MAUI Embedding. In this case, we're going to use the Blank template (`-preset blank`) and include .NET MAUI Embedding support (`-maui`).

```bash
dotnet new unoapp -preset blank -maui -platforms "android" -platforms "ios" -platforms "maccatalyst" -platforms "windows" -o TelerikApp
```

This will create a new folder called **TelerikApp** containing the new application.

---

1. Next, add a reference to the `Telerik.UI.for.Maui` NuGet package to the `TelerikApp.MauiControls` project.

1. In the `AppBuilderExtensions` class, on `TelerikApp.MauiControls` project, update the `UseMauiControls` extension method to call the `UseTelerik` method.

```cs
using Telerik.Maui.Controls;
using Telerik.Maui.Controls.Compatibility;

namespace MauiEmbeddingApp;
namespace TelerikApp;

public static class AppBuilderExtensions
{
Expand All @@ -38,22 +75,22 @@ In order to use the Telerik controls, you first need to create an account and or
.UseTelerik()
.ConfigureFonts(fonts =>
{
fonts.AddFont("MauiEmbeddingApp/Assets/Fonts/OpenSansRegular.ttf", "OpenSansRegular");
fonts.AddFont("MauiEmbeddingApp/Assets/Fonts/OpenSansSemibold.ttf", "OpenSansSemibold");
fonts.AddFont("Assets/Fonts/OpenSansRegular.ttf", "OpenSansRegular");
fonts.AddFont("Assets/Fonts/OpenSansSemibold.ttf", "OpenSansSemibold");
});
}
```

## Adding RadSignaturePad Control

1. Update the EmbeddedControl.xaml in the `MauiEmbeddingApp.MauiControls` project with the following XAML that includes the `RadSignaturePad` control.
1. Update the EmbeddedControl.xaml in the `TelerikApp.MauiControls` project with the following XAML that includes the `RadSignaturePad` control.

```xml
<?xml version="1.0" encoding="utf-8" ?>
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:telerik="http://schemas.telerik.com/2022/xaml/maui"
x:Class="MauiEmbeddingApp.MauiControls.EmbeddedControl"
x:Class="TelerikApp.MauiControls.EmbeddedControl"
HorizontalOptions="Fill"
VerticalOptions="Fill">
<telerik:RadSignaturePad x:Name="SignaturePad"
Expand All @@ -67,7 +104,7 @@ In order to use the Telerik controls, you first need to create an account and or
1. Update the EmbeddedControl.xaml.cs with the following code.

```cs
namespace MauiEmbeddingApp.MauiControls;
namespace TelerikApp.MauiControls;

public partial class EmbeddedControl : ContentView
{
Expand All @@ -80,7 +117,9 @@ In order to use the Telerik controls, you first need to create an account and or

1. Now the project is good to go! Press F5 and you should see the `RadSignaturePad` control working as expected.

## App Render Output
For more detailed instructions specific to each platform, refer to the [Debug the App](xref:Uno.GettingStarted.CreateAnApp.VS2022#debug-the-app) documentation.

**App Render Output**

- **Android:**
- ![Android Telerik](Assets/Screenshots/Android/Telerik.png)
Expand Down
Loading