Explore .NET MAUI Blazor Apps with .NET 6.0 & Visual Studio 2022 Version 17....
source link: https://blog.medhat.ca/2021/12/explore-net-maui-blazor-apps-with-net.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Friday, December 17, 2021
Explore .NET MAUI Blazor Apps with .NET 6.0 & Visual Studio 2022 Version 17.1.0 Preview 1.1
In a previous article, I wrote about .NET MAUI Apps. In this article, I will discuss the Blazor version of .NET MAUI Apps. This is known as .NET MAUI Blazor Apps.
MAUI is not yet officially released. The current bits offer a glimpse into what the final product will look like.
This is the environment that I am using:
- Windows 11 Version 21H2
- Visual Studio 2022 Version 17.1.0 Preview 1.1
- .NET 6.0.101
Setup
Application
Enter "maui" in the filter field. You will discover that there are three MAUI-related projects that you can create - namely:
- .NET MAUI App
- .NET MAUI Blazor App
- .NET MAUI Class Library
id (int)lastName (string)firstName (string)occupation (string)gender (string)pictureUrl (string)votes (int)
@page "/toons"@using System.Text.Json@using System.Text.Json.Serialization<h1>Toon Characters</h1>@if (toonList == null) {<p><em>Loading...</em></p>} else {<table class="table"><tbody>@foreach (var item in toonList) {<tr><td>@item.FullName</td><td><img src="@item.PictureUrl" style="height: 40px" alt="@item.FirstName @item.LastName"> </td></tr></tbody></table>@code {private Toon[] toonList;protected override async Task OnInitializedAsync() {HttpClient client = new HttpClient();var stream = client.GetStreamAsync("https://api4all.azurewebsites.net/api/people");toonList = await JsonSerializer.DeserializeAsync<Toon[]>(await stream);public class Toon {[JsonPropertyName("id")]public int Id { get; set; }[JsonPropertyName("lastName")]public string LastName { get; set; }[JsonPropertyName("firstName")]public string FirstName { get; set; }[JsonPropertyName("occupation")]public string Occupation { get; set; }[JsonPropertyName("gender")]public string Gender { get; set; }[JsonPropertyName("pictureUrl")]public string PictureUrl { get; set; }[JsonPropertyName("votes")]public int Votes { get; set; }public string FullName {return string.Format("{0} {1}", this.FirstName, this.LastName);
No comments:
Post a Comment
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK