Skip to content

Commit 6209f5e

Browse files
[4.3] docs(common): update the project wizard article and add hybrid template (#1481)
* docs(common): update the project wizard article and add hybrid template * docs(common): fixes as per comments
1 parent d6fd8fa commit 6209f5e

File tree

6 files changed

+37
-38
lines changed

6 files changed

+37
-38
lines changed

_contentTemplates/common/js-interop-file.md

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -141,33 +141,4 @@ builder.Services.AddTelerikBlazor();
141141
142142
await builder.Build().RunAsync();
143143
````
144-
````.NET_3.x
145-
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
146-
using Microsoft.Extensions.DependencyInjection;
147-
using System.Threading.Tasks;
148-
using System.Net.Http;
149-
using System;
150-
151-
namespace ClientBlazorProject.Client // Make sure this matches your actual WASM project namespace.
152-
{
153-
public class Program
154-
{
155-
public static async Task Main(string[] args)
156-
{
157-
// sample host builder for a WASM app, yours may differ
158-
var builder = WebAssemblyHostBuilder.CreateDefault(args);
159-
builder.RootComponents.Add<App>("app");
160-
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
161-
// There may be more code here.
162-
163-
// Register the Telerik services.
164-
builder.Services.AddTelerikBlazor();
165-
166-
// There may be more code here.
167-
// sample host builder for a WASM app, yours may differ
168-
await builder.Build().RunAsync();
169-
}
170-
}
171-
}
172-
````
173144
#end

getting-started/hybrid-blazor.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
2-
title: Blazor Hybrid with .NET MAUI (Tutorial)
2+
title: Blazor Hybrid with .NET MAUI
33
page_title: First Steps with Blazor Hybrid
44
description: Make your first steps with Telerik UI for Blazor and build a .NET MAUI Blazor Hybrid app that runs the UI for Blazor components.
5-
slug: getting-started-hybrid-maui
5+
slug: getting-started/hybrid-blazor
66
tags: get,started,first,steps,server,hybrid,maui
77
published: true
88
position: 3

getting-started/vs-integration/convert-project-wizard.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ The wizard adds the following client assets to your project:
2121
The wizard also configures the project to use the Telerik UI for Blazor components by adding the following utilities:
2222
* [Required `@using` directives]({%slug getting-started/what-you-need%}#common-configuration) to the `~/_Imports.razor` file.
2323
* [`TelerikLayout.razor` component]({%slug getting-started/what-you-need%}#common-configuration) at the root level of the DOM.
24-
* Registration for the Telerik services for [client-side projects]({%slug getting-started/what-you-need%}#client-side-project-specifics) and for [server-side projects]({%slug getting-started/what-you-need%}#server-side-project-specifics).
24+
* Registration for the Telerik services for [client-side projects]({%slug getting-started/what-you-need%}#client-side-project-specifics), for [server-side projects]({%slug getting-started/what-you-need%}#server-side-project-specifics), and for [hybrid projects]({%slug getting-started/what-you-need%}#blazor-hybrid-project-specifics).
2525

2626
## Getting the Wizard
2727

@@ -102,7 +102,7 @@ The most common reason for this problem is a mismatch between the installed vers
102102

103103
The cause are wrong paths to the needed web assets. To resolve this open the index file:
104104

105-
* `wwwroot/index.html` for a WebAssembly Blazor app
105+
* `wwwroot/index.html` for a WebAssembly and a Hybrid Blazor app
106106
* `~/Pages/_Host.cshtml` for a Server-Side Blazor app using .NET 3.x or .NET 5
107107
* `~/Pages/_Layout.cshtml` for a Server-Side Blazor app using.NET 6
108108

Loading

getting-started/vs-integration/new-project-wizard.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ The wizard adds the following client assets to your project:
2121
The wizard also configures the project to use the Telerik UI for Blazor components by adding the following utilities:
2222
* [Required `@using` directives]({%slug getting-started/what-you-need%}#common-configuration) to the `~/_Imports.razor` file.
2323
* [`TelerikLayout.razor` component]({%slug getting-started/what-you-need%}#common-configuration) at the root level of the DOM.
24-
* Registration for the Telerik services for [client-side projects]({%slug getting-started/what-you-need%}#client-side-project-specifics) and for [server-side projects]({%slug getting-started/what-you-need%}#server-side-project-specifics).
24+
* Registration for the Telerik services for [client-side projects]({%slug getting-started/what-you-need%}#client-side-project-specifics), for [server-side projects]({%slug getting-started/what-you-need%}#server-side-project-specifics), and for [hybrid projects]({%slug getting-started/what-you-need%}#blazor-hybrid-project-specifics).
2525

2626
## Getting the Wizard
2727

@@ -56,7 +56,7 @@ In the order of their appearance, the Create New Project wizard presents the fol
5656

5757
2. On the second screen, you can choose:
5858

59-
* A WebAssembly or server-side Blazor app.
59+
* A WebAssembly, server-side, or Hybrid Blazor app.
6060
* The .NET version you want to use.
6161
* The Telerik UI for Blazor version.
6262
* One of the [predefined Telerik project](#predefined-project-templates) templates.

getting-started/what-you-need.md

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ You can obtain the required UI for Blazor packages in four ways:
7070

7171
The Telerik UI for Blazor components require a [Telerik stylesheet](#telerik-stylesheet) and a [JS Interop file](#telerik-js-interop-file) in the app's main index file. Depending on the Blazor hosting model and framework version, this index file will differ:
7272

73-
* For Client-Side Blazor apps, use the `wwwroot/index.html` file.
73+
* For Client-Side and Blazor Hybrid apps, use the `wwwroot/index.html` file.
7474
* For Server-Side Blazor apps, use one of the following files:
7575
* `~/Pages/_Host.cshtml` for .NET 3.x
7676
* `~/Pages/_Layout.cshtml` for .NET 6
@@ -120,8 +120,9 @@ To use the Telerik components, you must add a few items to your projects. Some o
120120

121121
2. Follow the section for your project type:
122122

123-
* [Client-side (WASM)](#client-side-project-specifics).
124-
* [Server-side](#server-side-project-specifics).
123+
* [Client-side (WASM)](#client-side-project-specifics)
124+
* [Server-side](#server-side-project-specifics)
125+
* [Blazor Hybrid](#blazor-hybrid-project-specifics)
125126

126127

127128
### Common Configuration
@@ -162,6 +163,33 @@ The final step is to register the Telerik services. In a server-side Blazor proj
162163
**C#**
163164
@[template](/_contentTemplates/common/js-interop-file.md#register-telerik-service-server)
164165

166+
### Blazor Hybrid Project Specifics
167+
168+
The final step is to register the Telerik services. In a Hybrid Blazor project, you register services in the `MauiProgram.cs` file of the project:
169+
170+
**C#**
171+
<div class="skip-repl"></div>
172+
````MauiProgram.cs
173+
public static MauiApp CreateMauiApp()
174+
{
175+
var builder = MauiApp.CreateBuilder();
176+
builder
177+
.UseMauiApp<App>()
178+
.ConfigureFonts(fonts =>
179+
{
180+
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
181+
});
182+
183+
builder.Services.AddMauiBlazorWebView();
184+
185+
// Register the Telerik services.
186+
builder.Services.AddTelerikBlazor();
187+
188+
var host = builder.Build();
189+
190+
return host;
191+
}
192+
````
165193

166194
@[template](/_contentTemplates/common/get-started.md#next-steps-after-getting-started)
167195

0 commit comments

Comments
 (0)