locked
Shell: How to change side menu cell dynamically. RRS feed

  • Question

  • User374784 posted

    Earlier we were using MaterDetialsPage and achieved the below Side MenuList. Can we achieve same using Shell(Recently upgraded to Xamarin Forms 4.0). Attaching the ScreenShot.

    Note: Adding and removing Sections dynamically.

    Wednesday, September 18, 2019 9:53 AM

All replies

  • User382871 posted

    Get shell in code behind and add ShellSection with items.Add() method like below. ``` ShellSection shell_section = new ShellSection { Title = "home", };

    shell_section.Items.Add(new ShellContent() { Content = new HomePage() });

    ShellSection shell_section1 = new ShellSection { Title = "about", };

    shell_section1.Items.Add(new ShellContent() { Content = new AboutPage() });

    myshell.Items.Add(shellsection); myshell.Items.Add(shellsection1); ```

    Wednesday, September 18, 2019 11:50 AM
  • User374784 posted

    Thank you. But i was looking similar to Listiview. i.e Create a datasource and binding into list. If you observe the screenshot, we have 2 sections(ER Claims and Application) each as some items in it. As and when any item in Application is clicked(Say Item-A), Item-A and its related item should be grouped in section1. The ideal way how side menu work.!

    Thursday, September 19, 2019 1:16 PM
  • User382871 posted

    Set the Shell.ItemTemplate attached property to a DataTemplate to customsize the appearance of each FlyoutItem. <Shell ...> ... <Shell.ItemTemplate> <DataTemplate> ... </DataTemplate> </Shell.ItemTemplate> </Shell>

    Tutorial: https://docs.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/shell/flyout#define-flyoutitem-appearance

    Friday, September 20, 2019 2:55 PM