最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

c# - How can I add the MAUI Blazor start page to the mobile project using the .Net Maui Blazor hybrid and web app template? - St

programmeradmin1浏览0评论

I have a .Net Maui Blazor hybrid and web app solution, with the four mobile, web, shared and client projects. Most of the application is in the shared project and the mobile and web projects display them within their respective wrappers. I need to set specific starting conditions, depending on the environment. In the web project I have the following component

@page "/"

<MyAwesomeComponent @rendermode="RenderMode.InteractiveWebAssembly"/>

Which then displays MyAwesomeComponent from the shared project. If I add a similar component to the mobile project, it can't be found and if I create a mobile folder in the shared project and include the starting component the application errors with a multiple "/" starting point confliction. Can this be done?

UPDATE:

I've taught myself some XAML and made progress with the following:

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns=";
             xmlns:x=";
             xmlns:local="clr-namespace:myawesomenamespace" 
             xmlns:shared="clr-namespace:myawesomenamespace.myawesomeassembly;assembly=myawesomeassembly" 
             xmlns:blazor="clr-myawesomenamespace:Microsoft.AspNetCore.Components.WebView.Maui"
             x:Class="myawesomenamespace.MainPage">

  <BlazorWebView x:Name="blazorWebView" HostPage="wwwroot/myawesomehtmlpage.htm"> 
    <BlazorWebView.RootComponents>
      <RootComponent Selector="#app" ComponentType="{x:Type local:Myawesomerazorcomponent}"/> 
    </BlazorWebView.RootComponents>
  </BlazorWebView>

</ContentPage>

Unfortunately, none of the loaded web assemblies are interactive, despite including Rendermode.InteractiveWebAssembly in various different locations.

This also does not include the layout component, as it bypasses the Route.razor component.

I also tried the tag <RootComponent Selector="#app" ComponentType="{x:Type shared:Route}"/> with the appropriate xmlns pointer to my wasm project, but nothing loads.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论