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

前端 未结 2 1111
攒了一身酷
攒了一身酷 2021-01-21 10:30

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 regula

相关标签:
2条回答
  • 2021-01-21 11:14

    In codebehind:

    double appBarMiniSize = ApplicationBar.MiniSize; // 30.0
    
    0 讨论(0)
  • 2021-01-21 11:21

    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.

    0 讨论(0)
提交回复
热议问题