Search code examples
windows-phone-8transparentappbar

Windows Phone 8 ApplicationBar expanded unchangable transparancy


following Code...

<!--Navigation-Bar-->
<phone:PhoneApplicationPage.ApplicationBar>
    <shell:ApplicationBar IsVisible="True" ForegroundColor="White" IsMenuEnabled="True" BackgroundColor="#002B55">
        <shell:ApplicationBarIconButton Click="B_Search_Click" IconUri="Images\Pic_Search.png" Text="Search"/>
        <shell:ApplicationBarIconButton Click="B_Media_Click" IconUri="Images\Pic_Media.png" Text="Media"/>
        <shell:ApplicationBarIconButton Click="B_Scan_Click" IconUri="Images\Pic_Scan.png" Text="Scanner"/>
        <shell:ApplicationBarIconButton Click="B_Charts_Click" IconUri="Images\Pic_Charts.png" Text="Charts"/>
        <shell:ApplicationBar.MenuItems>
            <shell:ApplicationBarMenuItem Click="B_Logout_Click" Text="Logout"/>
        </shell:ApplicationBar.MenuItems>
    </shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>

gives me following ApplicationBar...

http://s14.directupload.net/file/d/3341/4xiadbvz_jpg.htm (Solid background when expanded)

BUT if I create the AppBar in CodeBehind like this...

 private void ResetApplicationBar()
        {
            ApplicationBar = new ApplicationBar();
            ApplicationBar.BackgroundColor = Color.FromArgb(150, 0, 43, 85);;
            ApplicationBar.ForegroundColor = Colors.White;
            ApplicationBar.Opacity = 1;

            ApplicationBarIconButton B_Search = new ApplicationBarIconButton();
            B_Search.IconUri = new Uri("/Images/Pic_Search.png", UriKind.Relative);
            B_Search.Text = "search";
            ApplicationBar.Buttons.Add(B_Search);
            B_Search.Click += new EventHandler(B_Search_Click);

            (more Buttons...)

then I get that misterios unchangable Transparency...

http://s1.directupload.net/file/d/3341/zjo57e37_jpg.htm (Half-Transparent when expanded)

How can I change the Background to solid??? -Yes I have mostly overwritten the theme -Changing global colors doesnt work -changing background/foreground doesnt work -changing opacity doesnt work...

I need to generate it from code behind because im changing it dynamically in one window (or is it possible to define multiple AppBars in markup?)

Thanks in advance!


Solution

  • Thank you very much for effort, but changing opacity didnt to 0.999 didnt help either.

    I found a solution!! And its quite simple :)

    I Just take the old bar instead of creating a new one:

    //Old Code
        ApplicationBar = new ApplicationBar();
    
    //New Code
        ApplicationBar.Buttons.Clear();
        ApplicationBar.MenuItems.Clear();
    

    Hope it helps someone!