如何在Windows Phone 8.1中创建透明命令栏

use*_*622 1 c# windows-phone-8.1

如何在Windows Phone 8.1中创建透明命令栏这是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>
Run Code Online (Sandbox Code Playgroud)

当CommandBar打开时,它具有透明背景,但后面有一个白色面板.热门删除此面板?

Moh*_*jNK 9

在Window.Current.Activate()之前,在App.xaml.cs,OnLaunched方法中使用此代码;

Windows.UI.ViewManagement.ApplicationView.GetForCurrentView().SetDesiredBoundsMode(
ApplicationViewBoundsMode.UseCoreWindow);
Run Code Online (Sandbox Code Playgroud)

编辑:Bydefault,框架仅在可见区域内布局窗口的内容.因此,当您展开appbar时,它会显示背后的基色(黑/白),尽管您将appbar设置为透明.因此,如果您想使用整个页面窗口,则必须使用上面的代码,该代码在整个应用程序中设置核心窗口.