Skip to content

Commit 793db81

Browse files
author
Bret Johnson
authored
Avoid qualified name in x:Type binding for Blazor Hybrid template (#29005)
Use an explicit XML namespace for Component, avoiding use qualified name syntax in the x:Type binding. Qualified names (like `local:Components.Routes`) aren't currently supported by XAML Hot Reload, producing the error "Nested types are not supported: Components.Routes" and causing XAML Hot Reload to not work. This support is coming in a future VS update, but for now it's best to avoid using of the qualified name syntax in our templates, to keep things broadly compatible and working for new users. We don't use qualified names in XAML bindings anywhere else in MAUI XAML templates; this is the last occurrence. Fixes #20669
1 parent 8e875b7 commit 793db81

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Templates/src/templates/maui-blazor/MainPage.xaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
33
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
44
xmlns:local="clr-namespace:MauiApp._1"
5+
xmlns:components="clr-namespace:MauiApp._1.Components"
56
x:Class="MauiApp._1.MainPage">
67

78
<BlazorWebView x:Name="blazorWebView" HostPage="wwwroot/index.html">
89
<BlazorWebView.RootComponents>
9-
<RootComponent Selector="#app" ComponentType="{x:Type local:Components.Routes}" />
10+
<RootComponent Selector="#app" ComponentType="{x:Type components:Routes}" />
1011
</BlazorWebView.RootComponents>
1112
</BlazorWebView>
1213

0 commit comments

Comments
 (0)