Windows 8 App Screen Layout

夙愿已清 提交于 2019-12-11 19:40:02

问题


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.


回答1:


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.

You can read about more about here

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.

Designing Your XAML UI with Blend Jump Start

Windows Store App Development Essentials with C# Refresh



来源:https://stackoverflow.com/questions/21036483/windows-8-app-screen-layout

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