rds1983 / Myra

UI Library for MonoGame, FNA and Stride
MIT License
728 stars 94 forks source link

MyraPad doesn't show suggestion to add MenuItem within MenuItem #320

Closed nightblade9 closed 3 years ago

nightblade9 commented 3 years ago

I figured out how to make a proper menu with multiple top-level options (File, Edit, etc.) each with their own sub-options when clicked.

It took me about 30 minutes of messing with MyraPad and reading through some of the code to figure out how this works; apparently, you can nest MenuItem objects within other MenuItem objects:

<Project>
  <Panel>
    <VerticalStackPanel>
      <HorizontalStackPanel>
        <HorizontalMenu>
          <MenuItem Text="&amp;File">
            <MenuItem Text="&amp;Save" />
            <MenuItem Text="E&amp;xit" />
          </MenuItem>
          <MenuItem Text="&amp;Help">
            <MenuItem Text="&amp;About" />
          </MenuItem>
        </HorizontalMenu>
      </HorizontalStackPanel>
    </VerticalStackPanel>
  </Panel>
</Project>

Produces this output:

image

It would be great if:

rds1983 commented 3 years ago

Thing is you can't nest MenuItems within 2nd level MenuItem(i.e. <MenuItem Text="&amp;Save" /> in your example). Hence I decided not to add autocomplete in the MyraPad. Though there are plans to add multilevel nested MenuItems.

nightblade9 commented 3 years ago

Nested menu items actually does work, as it shows in my screenshot - it just took a lot of trial and error to figure out. But, OK, if you're not planning to add auto-complete, I can just close this.