Home > database >  Set Parent view (xaml, maui)
Set Parent view (xaml, maui)

Time:12-04

I have a main layout with a content view that I want to populate with a bunch a different views.

I thought I would set the parent view from the child, but I haven't figured out how. There may be a better way to accomplish this though.

Layout file:

<ContentPage ...>

<Grid RowDefinitions="*,Auto,*">
...
<ContentView x:Name="ViewToPopulate"
    Grid.Row="1"/>
...
</ContentPage>

Sublayout file:

<ContentView ...
    Parent="StaticResource ViewToPopulate">

<GridView >
...
</GridView>
</ContentView>

CodePudding user response:

Like @Jason said, you don't set the parent from the child. I found the best way to do this is follow this suggestion that @Jason also made in the comment of: Header and Footer in .NET MAUI

  • Related