Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ContentPage to have a BlazorWebView for HTML usage #412

Open
johnmangam opened this issue Sep 21, 2021 · 7 comments
Open

ContentPage to have a BlazorWebView for HTML usage #412

johnmangam opened this issue Sep 21, 2021 · 7 comments

Comments

@johnmangam
Copy link

johnmangam commented Sep 21, 2021

Since Shell's Tab is expecting a ContentPage as a ShellContent, I was wondering if this is a valid way using BlazorWebView as ChildComponent so that I could use HTML as shown below.

  <ContentPage>
     <StackLayout>
            <BlazorWebView>
                <ProductItem></ProductItem>
            </BlazorWebView>
            <Label class="mylabel" Text="some text"></Label>
        </StackLayout>
</ContentPage>

ProductItem.razor

@page "/productitem"
<div>
    <h1>some heading text</h1>
</div> 

There is no error, but ProductItem is not seen.

@Eilon
Copy link
Member

Eilon commented Sep 21, 2021

Yes, in theory this should work, but maybe you're missing some parameters on the <BlazorWebView ...> tag? Is ProductItem a Razor component?

@johnmangam
Copy link
Author

johnmangam commented Sep 22, 2021

Thank you @Eilon. Yes, here is the code of ProductItem that I'm trying to use in a BlazorWebView.

ProductItem.razor

@page "/productitem"
<div>
    <h1>some heading text</h1>
</div> 

Does the BlazorWebView expect something else, please?

@johnmangam
Copy link
Author

johnmangam commented Sep 22, 2021

Good morning @Eilon

Looks like the BlazorWebView has no Host property yet in order to get the HTML working. Could you confirm?

Thank you.

@johnmangam
Copy link
Author

johnmangam commented Sep 22, 2021

O, sorry @Eilon I have just now come across BlazorWebView<IComponent> and MobileBlazorBindingsBlazorWebView that have Host property.

Perhaps, this is the way to go about it to get it working.

Thank you.

@johnmangam
Copy link
Author

Sorry @Eilon I couldn't get this working.

I would appreciate it if you or your team could provide a tiny code snippet to get this working.

In a Shell, ShellContent is a ContentPage where I want to have a BlazorWebView to show razor with HTML.

Thank you.

@johnmangam
Copy link
Author

johnmangam commented Sep 22, 2021

@Eilon

I got hold of passing the Host, but ContentPage is null here, could you let me know where I should be setting this? Thank you.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants