Reputation: 71
how to create transparent command bar in Windows Phone 8.1 Here is xaml
<Page x:Class="App3.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Background="White"
mc:Ignorable="d">
<Grid Background="Red" />
<Page.BottomAppBar>
<CommandBar Background="#CCFFFFFF" Foreground="Black">
<CommandBar.PrimaryCommands>
<AppBarButton Label="Button1" />
</CommandBar.PrimaryCommands>
</CommandBar>
</Page.BottomAppBar>
When CommandBar is open, it has a transparent background, but there is a white panel behind. Hot to remove this panel?
Upvotes: 1
Views: 2072
Reputation: 267
By changing the opacity you can make the commandbar transparent or add an x:Name to commandbar if you want to change background to tranparent
<CommandBar Background="#CCFFFFFF" Foreground="Black" x:name="op" opacity=0.4>
//and in the code
//add
op.Background = new SolidnewBrush(Windows.UI.Colors.Transparent);`
Upvotes: 1
Reputation: 895
Use this code in App.xaml.cs, OnLaunched Method, before Window.Current.Activate();
Windows.UI.ViewManagement.ApplicationView.GetForCurrentView().SetDesiredBoundsMode(
ApplicationViewBoundsMode.UseCoreWindow);
EDIT : Bydefault, the framework layouts the window's content within the visible region only. Hence, when you expanded the appbar, it shows the basecolor(black/white) behind it eventhough you set the appbar transparent. So if you want to make use of entire page window, you have to use the above code, which sets core window across the entire app.
Upvotes: 9