2
Vote

Empty space after menu item is removed

description

<p>When I remove a menu item, the application bar has the same height = empty space for the menu item is still allocated.</p>

comments

xyzzer wrote Mar 20, 2012 at 1:52 PM

Can you provide more details? How do you remove a menu item?

michalgabriel wrote Mar 27, 2012 at 8:59 AM

Here's my code in ViewModel:

private void SetMenuItems(object Parameter)
{
this.MenuItems.ToList().ForEach(MI => this.MenuItems.Remove(MI));

if (Parameter != null)
{
    this.MenuItems.Add(this.MenuItemTable[First]);
    this.MenuItems.Add(this.MenuItemTable[Second]);
    // IN THIS CASE THERE ARE TWO MENU ITEMS VISIBLE AND A SPACE BELOW
}
else
{
    this.MenuItems.Add(this.MenuItemTable[Third]);
    this.MenuItems.Add(this.MenuItemTable[Fourth]);
    this.MenuItems.Add(this.MenuItemTable[Fifth]);
    // THERE ARE THREE MENU ITEMS VISIBLE
}
}
public ObservableCollection MenuItems { get; private set; }

PS: I hope it's not a problem of the WP7 emulator (I don't have a developer account yet).

michalgabriel wrote Apr 11, 2012 at 9:31 AM

PS: The same issue is in the phone.

altso wrote May 11, 2012 at 9:22 PM

Application bar remains visible but empty if you set BindableApplicationBar to null:

Bindable.SetApplicationBar(page, null)