question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Define a default namespace for .NET MAUI Blazor controls similar to that of Community Toolkit

See original GitHub issue

Description

Request to consider defining a default HTTP alias for .NET MAUI Blazor controls similar to that of Community Toolkit so that it becomes easier to manage them while using in XAML code

Public API Changes

Instead of the complex xmlns definition with clr-namespace and assembly names as shown in the below example, when defined with appropriate HTTP alias this will become easy to manage.

such as xmlns:b="http://..."

<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:b="clr-namespace:Microsoft.AspNetCore.Components.WebView.Maui;assembly=Microsoft.AspNetCore.Components.WebView.Maui"
             xmlns:local="clr-namespace:MauiBlazorApp"
             x:Class="MauiBlazorApp.MainPage"
             BackgroundColor="{DynamicResource PageBackgroundColor}">
    <b:BlazorWebView HostPage="wwwroot/index.html">
        <b:BlazorWebView.RootComponents>
            <b:RootComponent Selector="#app" ComponentType="{x:Type local:Main}" />
        </b:BlazorWebView.RootComponents>
    </b:BlazorWebView>
</ContentPage>

Intended Use-Case

Allows for quick definition and better source management.

This will result in quite like the community toolkit definition:

xct=“http://xamarin.com/schemas/2020/toolkit

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
StephaneDelcroixcommented, Mar 31, 2022

@Eilon XmlnsDefinitionAttribute is your friend

0reactions
egvijayanandcommented, Apr 6, 2022

Adding the BlazorWebView into the same namespace as other .NET MAUI controls certainly helps in managing a common namespace (added OOB in the template itself). 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

XAML namespaces - .NET MAUI
The default namespace specifies that elements defined within the XAML file with no prefix refer to .NET Multi-platform App UI (.NET MAUI) ...
Read more >
New .Net MAUI App project throws 'The name ...
After changing namespace to MAUI, I updated the Build Action(RightClick on Xaml Page>>Properties>>BuildAction) of XAML Page to MauiXaml and ...
Read more >
Introducing MediaElement for .NET MAUI - YouTube
NET MAUI app. In this video I will show you how to get started with this amazing new control that is part of...
Read more >
Why Evolve to .NET MAUI?
NET MAUI enables just that and brings Blazor goodness to mobile and desktop through Blazor Hybrid apps. Essentially, .NET MAUI provides the app ......
Read more >
Use .NET MAUI for Native, No-Compromise Apps
NET code works the same in .NET MAUI as it does in Blazor, ASP.NET, or any other .NET app. It all uses the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found