What is the Height of the Minimized Application Bar in Windows Phone

喜夏-厌秋 提交于 2019-12-31 03:05:10

问题


I'm curious of how it would be possible to get the height of the Windows Phone application bar when in 'mini' mode. I've seen several resources on the height when the regular icon buttons are shown, but none with only the ellipses.


回答1:


In codebehind:

double appBarMiniSize = ApplicationBar.MiniSize; // 30.0



回答2:


I'll help you solve this yourself. Create a test app and modify the mainpage to have the following 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>

Run the application. You'll notice the height will be displayed in the TextBlock. Take that amount and subtract it from 800 and you will have your answer.



来源:https://stackoverflow.com/questions/19507349/what-is-the-height-of-the-minimized-application-bar-in-windows-phone

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!