這篇博客將介紹如何在UWP開發(fā)中使用AdaptiveTrigger實(shí)現(xiàn)自適應(yīng)布局。

場(chǎng)景1:窗體寬度大于800時(shí),窗體背景色為綠色,窗體在0到800之間為藍(lán)色。

平面設(shè)計(jì)培訓(xùn),網(wǎng)頁設(shè)計(jì)培訓(xùn),美工培訓(xùn),游戲開發(fā),動(dòng)畫培訓(xùn)

XAML Code:

平面設(shè)計(jì)培訓(xùn),網(wǎng)頁設(shè)計(jì)培訓(xùn),美工培訓(xùn),游戲開發(fā),動(dòng)畫培訓(xùn)

<Grid x:Name="LayoutRoot" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
    <VisualStateManager.VisualStateGroups>
        <VisualStateGroup x:Name="WindowStates">
            <!--Windows's size >= 800, background green-->
            <VisualState x:Name="WideState">
                <VisualState.StateTriggers>
                    <AdaptiveTrigger MinWindowWidth="800" />
                </VisualState.StateTriggers>
       &n
        
		

網(wǎng)友評(píng)論