1

I'm playing with the xamarin shell, I would like to insert a descriptive label as the header of the various items. as shown in the picture

image description here

this is my base code:

  <ShellContent Title="Main"
              Icon="main.png">
        <_vm:DashboardPage/>
    </ShellContent>
    <ShellContent Title="Posizioni"
              Icon="sec.png">
        <_vm:DashboardPage/>
    </ShellContent>
    <ShellContent Title="Fornitori"
              Icon="sec.png">
        <_vm:DashboardPage/>
    </ShellContent>
    <ShellContent Title="Clienti"
              Icon="sec.png">
        <_vm:DashboardPage/>
    </ShellContent>

I think I got lost in the solutions found on the web, but i don't go found solution. thanks

silverkaos
  • 13
  • 3
  • Does this answer your question? [Adding a shell flyout item header](https://stackoverflow.com/questions/59137346/adding-a-shell-flyout-item-header). google `xamarin forms shell flyout group header`. – ToolmakerSteve Jan 05 '22 at 17:22

1 Answers1

1

You can use a MenuItem as a header in your shellpage. Such as:

<MenuItem>
    <Shell.MenuItemTemplate>
        <DataTemplate>
            <Label HeightRequest="50"  Text="hello" FontSize="40"></Label>
        </DataTemplate>
    </Shell.MenuItemTemplate>
</MenuItem>
<FlyoutItem FlyoutDisplayOptions="AsMultipleItems">
    <ShellContent Title="About" Icon="icon_about.png" Route="AboutPage" ContentTemplate="{DataTemplate local:AboutPage}" />
    <ShellContent Title="Browse" Icon="icon_feed.png" Route="ItemsPage" ContentTemplate="{DataTemplate local:ItemsPage}" />
</FlyoutItem>
<MenuItem>
    <Shell.MenuItemTemplate>
        <DataTemplate>
            <Label HeightRequest="50"  Text="hello" FontSize="40"></Label>
        </DataTemplate>
    </Shell.MenuItemTemplate>
</MenuItem>
<MenuItem Text="Logout" StyleClass="MenuItemLayoutStyle" Clicked="OnMenuItemClicked">
</MenuItem>
Liyun Zhang - MSFT
  • 8,271
  • 1
  • 2
  • 14