防止应用程序栏向上滚动布局 [英] Prevent Application Bar from scrolling up Layout

查看:17
本文介绍了防止应用程序栏向上滚动布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个带有 ApplicationBar 的 Windows Phone 8 应用程序,以保留应用程序的快捷方式和一些菜单选项.我在某处读到 ApplicationBarHeight 是 72px.所以我尝试使用此代码

I am building a windows phone 8 application with an ApplicationBar to keep the shortcuts and some menu options for the application. I read somewhere that that Height for ApplicationBar is 72px. So I tried with this code

<Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="*"></RowDefinition>
            <RowDefinition Height="72"></RowDefinition>
        </Grid.RowDefinitions>
        <ScrollViewer Grid.Row="0" Name="scrollViewer" Width="Auto" VerticalAlignment="Top" >
            <Grid x:Name="ContentPanel" Background="DarkSeaGreen">
                <TextBlock Name="tb" FontSize="100" TextWrapping="Wrap"
                       Text="Hello eveyone. Need some help with AppBar">
                </TextBlock>
        </Grid>
        </ScrollViewer>
</Grid>

我希望 ApplicationBar 适合 Grid 中提供的空间,而不是向上滚动我的布局.但事情是这样的.http://i.stack.imgur.com/cjEXD.png

I was expecting the ApplicationBar to fit in space provided in the Grid and not to scroll up my layout. But what happened is this. http://i.stack.imgur.com/cjEXD.png

ApplicationBar 将 Layout 向上推,留下空白.我想阻止这件事.我希望我的应用程序栏可见,但它不应该向上滚动我的布局.如果您知道任何解决方案,请提供帮助.

ApplicationBar pushed up the Layout leaving a blank space. I wish to prevent this thing. I want my Application Bar to be visible but it should not scroll up my layout. Please help if you know of any kind of solution to this.

谢谢

推荐答案

您可以通过将 ApplicationBar 的 Opacity 设置为 Opacity 的值来实现此目的.1.然后它会覆盖您的布局并且不会将其向上推.在我看来 Opacity="0.99" 是一个不错的选择.

You can achieve this by setting the Opacity of your ApplicationBar to a value < 1. Then it overlays your layout and does not push it up. In my eyes Opacity="0.99" is a good option.

但要小心:ApplicationBar 的高度并不总是 72 像素.例如,在 1080p 设备上就不同了!

But be careful: The ApplicationBar's height is not always 72px. On a 1080p device for example it differs!

要确定应用程序栏的实际高度,您可以分别使用 ApplicationBar.DefaultSizeApplicationBar.MiniSize.

To determine the actual height of your Application Bar you can use ApplicationBar.DefaultSize or respectively ApplicationBar.MiniSize.

有关详细信息,请参阅 MSDN 文档.

For more information the the MSDN documentation.

这篇关于防止应用程序栏向上滚动布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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