how to set applicationbar opacity from code behind
I have been attempting to set the applicationbar on my MainPage in the code behind based on a slider bar that the user may control at will. I have a lot of information in my applicationbar so I created it in xaml, except for the opacity which should change depending on the values of the slider. I am unsure though of how to access the MainPage applicationbar opacity from the codebehind?
ApplicationBar = new ApplicationBar(); ApplicationBar.Opacity=0.5; ApplicationBar.IsMenuEnabled = true; ApplicationBarIconButton button1 = new ApplicationBarIconButton(new Uri("/Images/appbar.feature.search.rest.png", UriKind.Relative)); button1.Text = "Search"; ApplicationBar.Buttons.Add(button1); ApplicationBarMenuItem menuItem1 = new ApplicationBarMenuItem("MenuItem 1"); ApplicationBar.MenuItems.Add(menuItem1);
To change the opacity value of a currently existing ApplicationBar, use the following
(ApplicationBar as ApplicationBar).Opacity = num;
where num is your opacity of preference!