0

I am wondering if it is possible to programmatically change the app bar mode between minimized and default size. For instance, if the application bar is minimized when the user presses the ellipses, can I swtich to default mode and only show the buttons (no menu items). Then when a user selects again the menu items are shown using the default mode, and then when that menu is closed it returns back to minimized mode?

EDIT:

enum AppBarMode { IsMinimized, IsShowingButtons, IsShowingMenu };
AppBarMode mode;

void ApplicationBar_StateChanged(object sender, ApplicationBarStateChangedEventArgs e)
    {
        //if (e.IsMenuVisible)
        //    ApplicationBar.Mode = ApplicationBarMode.Minimized;
        //else
        //    ApplicationBar.Mode = ApplicationBarMode.Default;

        if (mode == AppBarMode.IsMinimized)
        {
            ApplicationBar.Mode = ApplicationBarMode.Default;
            mode = AppBarMode.IsShowingButtons;
        }
        if(mode == AppBarMode.IsShowingButtons)
        {
            ApplicationBar.Mode = ApplicationBarMode.Default;
            mode = AppBarMode.IsShowingMenu;
        }
        if(mode == AppBarMode.IsShowingMenu
        {
            ApplicationBar.Mode = ApplicationBarMode.Minimized;
            mode = AppBarMode.IsMinimized;
        }
    }
Matthew
  • 3,976
  • 15
  • 66
  • 130

1 Answers1

1

Yes it it, just change the Mode property value.

Looking at your code, you need and else before second and third if, otherwise you are switching the mode twice.

Igor Kulman
  • 16,211
  • 10
  • 57
  • 118
  • Could you please take a look at my edit above. Both don't seem to work the way I would like them to. – Matthew Apr 13 '14 at 00:28