星空网 > 软件开发 > 操作系统

windows 10 自适应布局

https://msdn.microsoft.com/library/windows/apps/dn894631.aspx

Use visual state triggers to build UI that can adapt to available screen space

Your UI may need to adapt to changes in window size. Adaptive visual states allows you to change the visual state in response to changes in the size of the window.

StateTriggers define a threshold at which a visual state is activated, which then sets layout properties as appropriate for the window size that triggered the state change.

In the following example, when the window size is 720 pixels or more in width the best-rated games are displayed to the right of the top free games panel and aligned with the top of the top free games panel. The visual state named wideView is triggered when the window is a minimum of 720 pixels wide, which then arranges the Best-rated games panel to appear to the right of, and aligned with the top of, the Top free games panel.

windows  10 自适应布局images/loading.gif' data-original="https://i-msdn.sec.s-msft.com/dynimg/IC795474.png" />

When the window is less than 720 pixels, the narrowView visual state is triggered because the wideViewtrigger is no longer satisfied and so no longer in effect. The narrowView visual state positions the Best-rated games panel below, and aligned with the left of, the Top paid games panel:

windows  10 自适应布局

Here is the XAML for the visual state triggers described above. The definition of the panels, alluded to by "..." below, has been removed for brevity.

XAML

 
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">  <VisualStateManager.VisualStateGroups>    <VisualStateGroup>      <VisualState x:Name="wideView">        <VisualState.StateTriggers>          <AdaptiveTrigger MinWindowWidth="720" />        </VisualState.StateTriggers>        <VisualState.Setters>          <Setter Target="best.(RelativePanel.RightOf)" Value="free"/>          <Setter Target="best.(RelativePanel.AlignTopWidth)" Value="free"/>        </VisualState.Setters>      </VisualState>      <VisualState x:Name="narrowView">        <VisualState.Setters>          <Setter Target="best.(RelativePanel.Below)" Value="paid"/>          <Setter Target="best.(RelativePanel.AlignLeftWithPanel)" Value="true"/>        </VisualState.Setters>        <VisualState.StateTriggers>          <AdaptiveTrigger MinWindowWidth="0" />        </VisualState.StateTriggers>      </VisualState>    </VisualStateGroup>  </VisualStateManager.VisualStateGroups>  ...</Grid>

 








原标题:windows 10 自适应布局

关键词:Windows

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

天津互联在线:https://www.ikjzd.com/w/1573200968230019074
和协知识产权:https://www.ikjzd.com/w/1573200969216024577
匈牙利:https://www.ikjzd.com/w/1573200969836437506
灵狗浏览器:https://www.ikjzd.com/w/1573200970667253762
火龙果申诉:https://www.ikjzd.com/w/1573200976979337218
货源:https://www.ikjzd.com/w/1573200980721000449
七月份适合去日本旅游吗 7月份去日本哪里好玩:https://www.vstour.cn/a/363192.html
凤岗汽车站到松山湖风景区 松岗汽车站到凤凰山怎么坐车:https://www.vstour.cn/a/363193.html
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流