VijayAnand.MauiBlazor.Markup 4.0.0

Prefix Reserved
This package has a SemVer 2.0.0 package version: 4.0.0+sha.7eef6c4.
dotnet add package VijayAnand.MauiBlazor.Markup --version 4.0.0                
NuGet\Install-Package VijayAnand.MauiBlazor.Markup -Version 4.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="VijayAnand.MauiBlazor.Markup" Version="4.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add VijayAnand.MauiBlazor.Markup --version 4.0.0                
#r "nuget: VijayAnand.MauiBlazor.Markup, 4.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install VijayAnand.MauiBlazor.Markup as a Cake Addin
#addin nuget:?package=VijayAnand.MauiBlazor.Markup&version=4.0.0

// Install VijayAnand.MauiBlazor.Markup as a Cake Tool
#tool nuget:?package=VijayAnand.MauiBlazor.Markup&version=4.0.0                

.NET MAUI Blazor Toolkit

This markup package is a set of fluent helper methods and classes to simplify working with .NET MAUI Blazor in C#.

It depends on the Microsoft.AspNetCore.Components.WebView.Maui NuGet package.

The most useful method will be Configure, which can be invoked on an instance of a BlazorWebView and its derivatives, and it simplifies the initialization of BlazorWebView into a single fluent method call as shown in the below sample.

Note: Gateway is a Razor component and assumes it can receive a parameter named Foo as described in the sample underneath.

namespace MyApp;

public class HomePage : ContentPage
{
    public HomePage()
    {
        // A BlazorWebView can manage multiple RootComponents, to achieve this, define another Tuple with values of that component
        // The method and Tuple parameter names are shown for clarity and it's optional
        // Blazor component can have initialization parameters, which can be supplied through parameters, a dictionary of keyValues
        // where the key is of type string and value is of type object

        // Without initialization parameters
        Content = new BlazorWebView().Configure(hostPage: "wwwroot/index.html", (selector: "#app", componentType: typeof(Gateway), parameters: null));

        // With optional initialization parameters
        Content = new BlazorWebView().Configure(hostPage: "wwwroot/index.html", (selector: "#app", componentType: typeof(Gateway), parameters: new Dictionary<string, object?> { [nameof(Gateway.Foo)] = "Bar" }));

        // In a simplified form - Real intended usage
        // Without initialization parameters
        Content = new BlazorWebView().Configure("wwwroot/index.html", ("#app", typeof(Gateway), null));
        // Much more simplified, assuming hostPage is wwwroot/index.html and selector as #app
        Content = new BlazorWebView().Configure(typeof(Gateway));

        // With StartPath property introduced in .NET 8 or later, overloaded Configure method
        // Assuming search is the page with which the app is intended to start
        Content = new BlazorWebView().Configure("wwwroot/index.html", "/search", ("#app", typeof(Gateway), null));
        // Much more simplified version, assuming hostPage is wwwroot/index.html and selector as #app
        Content = new BlazorWebView().Configure(typeof(Gateway), "/search");

        // With optional initialization parameters
        Content = new BlazorWebView().Configure("wwwroot/index.html", ("#app", typeof(Gateway), new Dictionary<string, object?> { [nameof(Gateway.Foo)] = "Bar" }));
    }
}
@page "/gateway"

<h2>I'm a razor component named Gateway and I can receive a parameter named Foo.</h2>

@code {
    [Parameter]
    public string Foo { get; set; }
}
Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on VijayAnand.MauiBlazor.Markup:

Repository Stars
egvijayanand/dotnet-maui-samples
.NET MAUI Samples
Version Downloads Last updated
4.0.0 34 11/15/2024
4.0.0-rc.2 35 10/9/2024
4.0.0-rc.1 39 9/11/2024
4.0.0-preview.7 48 8/16/2024
4.0.0-preview.6 42 7/10/2024
4.0.0-preview.5 42 6/12/2024
4.0.0-preview.4 56 5/24/2024
4.0.0-preview.3 57 4/18/2024
4.0.0-preview.2 63 3/17/2024
4.0.0-preview.1 69 2/18/2024
3.0.8 55 7/10/2024
3.0.7 45 6/12/2024
3.0.6 54 5/24/2024
3.0.5 75 4/18/2024
3.0.4 78 4/1/2024
3.0.3 81 3/17/2024
3.0.2 72 2/18/2024
3.0.1 72 1/26/2024
3.0.0 183 11/14/2023
3.0.0-rc.2.2 62 11/7/2023
3.0.0-rc.2.1 72 10/31/2023
3.0.0-rc.2 64 10/13/2023
3.0.0-rc.1 81 9/18/2023
3.0.0-preview.7 104 8/24/2023
3.0.0-preview.6 87 8/8/2023
3.0.0-preview.5 106 4/13/2023
3.0.0-preview.4 101 3/27/2023
3.0.0-preview.3 97 3/21/2023
3.0.0-preview.2 91 3/17/2023
3.0.0-preview.1 94 2/27/2023
2.0.10 76 11/7/2023
2.0.9 81 10/31/2023
2.0.8 98 10/13/2023
2.0.7 104 8/24/2023
2.0.6 91 8/24/2023
2.0.5 164 4/13/2023
2.0.4 114 3/27/2023
2.0.3 117 2/27/2023
2.0.1 308 12/13/2022
2.0.0 346 11/14/2022
1.0.12 107 8/24/2023
1.0.11 99 3/27/2023
1.0.10 112 2/27/2023
1.0.8 297 12/13/2022
1.0.7 330 11/14/2022
1.0.1 450 6/15/2022
1.0.0 641 5/23/2022
1.0.0-pre7 148 5/11/2022
1.0.0-pre6 156 4/28/2022
1.0.0-pre5 149 4/12/2022
1.0.0-pre4 144 3/18/2022
1.0.0-pre3 158 2/25/2022
1.0.0-pre2 174 1/31/2022
1.0.0-pre1 131 1/31/2022

Join me on Developer Thoughts, https://egvijayanand.in/, an exclusive blog for .NET MAUI and Blazor.

What's new in ver. 4.0.0:
-------------------------
This version of package is built on top of .NET MAUI 9 GA (v9.0.0).

v4.0.0-rc.2:

This version of package is built on top of .NET MAUI 9 RC2 (v9.0.0-rc.2.24503.2).

4.0.0-rc.1:

This version of package is built on top of .NET MAUI 9 RC1 (v9.0.0-rc.1.24453.9).

v4.0.0-preview.7:

This version of package is built on top of .NET MAUI 9 Preview 7 (v9.0.0-preview.7.24407.4).

v4.0.0-preview.6:

This package version is built upon .NET MAUI 9 Preview 6 (v9.0.0-preview.6.24327.7).

v4.0.0-preview.5:

This version of package is released on top of .NET MAUI on .NET 9 Preview 5 (9.0.0-preview.5.24307.10) version.

Non-dependent Microsoft.Maui.Controls.Compatibility package reference has been removed.

v4.0.0-preview.4:

This version of package is released on top of .NET MAUI on .NET 9 Preview 4 (9.0.0-preview.4.10690) version.

v4.0.0-preview.3:

This version of package is released on top of .NET MAUI on .NET 9 Preview 3 (9.0.0-preview.3.10457) version.

v4.0.0-preview.2:

This version of package is released on top of .NET MAUI on .NET 9 Preview 2 (9.0.0-preview.2.10293) version.

v4.0.0-preview.1:

This version of package is released on top of .NET MAUI on .NET 9 Preview 1 (9.0.0-preview.1.9973) version.