AC Thompson
AC Thompson

Reputation: 340

How to access XAML page's BindingContext from within BlazorWebView control in .NET MAUI

The razor page is being hosted in the BlazorWebView control on the XAML page. I would like to be able to get to the view model I have assigned to the BindingContext of said XAML from within the razor page.

DaySummaryPage.XAML

<BlazorWebView HostPage="wwwroot/index.html" x:Name="bWebviewAdventureLocMain" >
    <BlazorWebView.RootComponents>
        <RootComponent Selector="#app" ComponentType="{x:Type razor:DaySummaryPage}" />
    </BlazorWebView.RootComponents>
</BlazorWebView>

DaySummaryPage.razor

@code {
 // Access DaySummaryPage.XAML's BindingContext

Upvotes: 4

Views: 1135

Answers (1)

Alexandar May - MSFT
Alexandar May - MSFT

Reputation: 10078

There's no BindingContext in Blazor. You can refer to the Component parameters part in this doc, and check Binding with component parameters.

You can refer to this thread for more details.

Upvotes: 1

Related Questions