這篇博客將介紹如何在UWP開發(fā)中使用AdaptiveTrigger實(shí)現(xiàn)自適應(yīng)布局。
場(chǎng)景1:窗體寬度大于800時(shí),窗體背景色為綠色,窗體在0到800之間為藍(lán)色。
XAML Code:
<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