如何在 Windows Phone 8.1 中创建透明命令栏 [英] How to create transparent command bar in Windows Phone 8.1

查看:28
本文介绍了如何在 Windows Phone 8.1 中创建透明命令栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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>

CommandBar 打开时,它有一个透明的背景,但后面有一个白色的面板.想要移除此面板吗?

When CommandBar is open, it has a transparent background, but there is a white panel behind. Hot to remove this panel?

推荐答案

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

Use this code in App.xaml.cs, OnLaunched Method, before Window.Current.Activate();

Windows.UI.ViewManagement.ApplicationView.GetForCurrentView().SetDesiredBoundsMode(
ApplicationViewBoundsMode.UseCoreWindow);

默认情况下,框架仅在可见区域内布局窗口内容.因此,当您展开 appbar 时,即使您将 appbar 设置为透明,它也会显示其背后的底色(黑色/白色).所以如果你想使用整个页面窗口,你必须使用上面的代码,它在整个应用程序中设置核心窗口.

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.

这篇关于如何在 Windows Phone 8.1 中创建透明命令栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆