I have not actually tested this, but it should work for your simple case:
var names = baseMenu.Items.Cast<menuitem>().Select(j => j.Name);</menuitem>
What I have had to do is dynamically change a context menu depending on the selected record. I used the
ContextMenuOpening
event and then used a method in the ViewModel to determine if
MenuItem
should be visible