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

[Bug] MenuBuilder does not return options list for MenuBar control #80

Open
zohaibhanif opened this issue Oct 18, 2019 · 2 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@zohaibhanif
Copy link
Contributor

Description

I am using MenuBuilder class to register menu options for MenuBar control. But it does not return options list when GetOptions method is called.

Steps to reproduce

  1. Add a page for MenuBar and inject IMenuBuilder dependency in it.
  2. Register MainMenuOptions using RegisterOption provided in MenuBuilder.
menuBuilder.RegisterOption(new MainMenuOption { FontFamily = string.Empty, Glyph = string.Empty, Priority = 3, Text = "Badge View", Uri = "BadgeViewPage" });
menuBuilder.RegisterOption(new MainMenuOption { FontFamily = string.Empty, Glyph = string.Empty, Priority = 1, Text = "Image Entry", Uri = "ImageEntryPage" });
menuBuilder.RegisterOption(new MainMenuOption { FontFamily = string.Empty, Glyph = string.Empty, Priority = 2, Text = "Borderless Date Picker", Uri = "BorderlessDatePickerPage" });
menuBuilder.RegisterOption(new MainMenuOption { FontFamily = string.Empty, Glyph = string.Empty, Priority = 4, Text = "Repeater View", Uri = "RepeaterViewPage" });
MenuOptions = menuBuilder.GetOptions();
  1. Get menu options list through GetOptions method.

Expected Behavior

It should return sorted menu options list based on priority.

Actual Behavior

It returns empty list.

Basic Information

  • Version with issue: AP.MobileToolkit - 3.0.0-ci
  • Xamarin.Forms version: 4.2.0.815419
  • IDE: Visual Studio 2019 Professional - Version 16.3.5

Reproduction Link

Project: ToolkitDemo
Branch: issue/75/Demo-User-Controls

@zohaibhanif zohaibhanif added the bug Something isn't working label Oct 18, 2019
@dansiegel dansiegel assigned zohaibhanif and unassigned dansiegel Oct 18, 2019
@dansiegel
Copy link
Member

this is an issue within the sample project. you will need to address this

@zohaibhanif
Copy link
Contributor Author

this is an issue within the sample project. you will need to address this

I debugged MenuBuilder to figure out the problem and my finding are given below:

  1. MenuBuilder.RegisterOption method executes with the option as parameter. It adds option to Options collection.
    menu option 0

  2. Options.ReplaceRange method executes with the sorted list as parameter. In this method, it shows the item in the collection parameter.
    menu option 1

  3. When Items.Clear method executes, it clears up the Items list as well as collection parameter.
    menu option 2

  4. Options list in MenuBuilder gets empty.
    menu option 3

@zohaibhanif zohaibhanif assigned dansiegel and unassigned zohaibhanif Oct 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants