c# - use many application bars in a pivot control -


i'm trying create pivot control, , eatch item of pivot control want assosiate different applicationbar. tried follow this walkthrough in msdn, seems there error in code:

private void pivot_selectionchanged(object sender, selectionchangedeventargs e)     {         switch (((pivot)sender).selectedindex)         {             case 0:                 applicationbar  = ((applicationbar)application.current.resources["countingappbar"]);                 break;              case 1:                 applicationbar  = ((applicationbar)application.current.resources["savingappbar"]);                 break;         }     } 

the error applicationbar class , it's used variable, tried create instance before switch statement, here did:

private void pivot_selectionchanged(object sender, selectionchangedeventargs e)     {         applicationbar appbar;         switch (((pivot)sender).selectedindex)         {             case 0:                 appbar = ((applicationbar)application.current.resources["countingappbar"]);                 break;              case 1:                 appbar = ((applicationbar)application.current.resources["savingappbar"]);                 break;         }     } 

but doesn't seem work. level in programming still beginner, appreciated if answer detailed. thank you.

http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh394044%28v=vs.105%29.aspx

why don't use 1 applicationbar , add or remove applicationbarbuttons based on selected pivot control? should pretty straightforward considering many apps it.

ps: personal experience, add application bar via code in c#...i have faced issues while changing xaml app bars.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -