Windows 8应用程序屏幕布局 [英] Windows 8 App Screen Layout

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

问题描述

如何设计可适应不同屏幕尺寸的应用程序?到目前为止,我已经拉伸了网格,因为在我的计算机上,它充满了屏幕.其他计算机对此会有不同看法吗?我应该使用滚动条吗?我还尝试了<viewbox stretch="fill" stretchdirection="both"> <grid width="1024" height="575"使用此功能,应用程序中的所有内容看起来都被拉伸和放大了.

How can I design an app that adjusts to different screen sizes? So far I stretched the grid because on my computer that fills the screen. Will other computers see this differently? Should I use a scrollbar, if so how? I also tried <viewbox stretch="fill" stretchdirection="both"> <grid width="1024" height="575" Using this everything in the app looks stretched and zoomed in.

推荐答案

您不必一定要对像素值进行硬编码,因为Windows 8支持各种类型的布局,以便在XAML中制作自适应布局,例如flexbox和带有一些网格的网格其他人.

You don't necessarily have to hard code the pixel values as Windows 8 supports various types of layout for making a responsive layouts in XAML like flexbox and grids with some others.

例如网格中的响应式布局将是这样的

Ex. for resoponsive layout in Grid will be some thing like this

 <Grid x:Name="LayoutRoot" Background="#FF0C0C0C">
     <Grid.ColumnDefinitions>
         <ColumnDefinition Width="Auto" />
         <ColumnDefinition Width="*" />
         <ColumnDefinition Width="Auto"  />
         <ColumnDefinition Width="2*" />
     </Grid.ColumnDefinitions>
 </Grid>


Auto    The size is determined by the size properties of the content object.
*       The value is expressed as a weighted proportion of available space.

您可以阅读有关我建议您看一下Microsoft Virtual Academy上的以下课程,以了解有关使用XAML创建响应式设计的更多信息.

I would recommend that you take a look at the following courses on Microsoft Virtual Academy to know more about creating responsive designs with XAML.

使用Blend Jump Start设计您的XAML UI

具有C#刷新的Windows Store App Development Essentials

这篇关于Windows 8应用程序屏幕布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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