Windows Phone中最小化应用程序栏的高度是多少

时间:2013-10-22 01:01:10

标签: windows-phone-7 windows-phone-8

我很好奇在“迷你”模式下如何获得Windows Phone应用程序栏的高度。我在常规图标按钮显示时看到了几个关于高度的资源,但没有一个只有省略号。

2 个答案:

答案 0 :(得分:3)

在代码背后:

double appBarMiniSize = ApplicationBar.MiniSize; // 30.0

答案 1 :(得分:0)

我会帮你解决这个问题。创建一个测试应用并修改主页以获得以下xaml

<phone:PhoneApplicationPage
    x:Class="WinPhone8App.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    shell:SystemTray.IsVisible="False">

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <TextBlock Text="{Binding ActualHeight, ElementName=LayoutRoot}" />
    </Grid>
    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar Mode="Minimized">
            <shell:ApplicationBar.MenuItems>
                <shell:ApplicationBarMenuItem Text="test" />
            </shell:ApplicationBar.MenuItems>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>
</phone:PhoneApplicationPage>

运行该应用程序。您会注意到高度将显示在TextBlock中。取出这个数量并从800减去它,你就会得到答案。