我有 3 个视觉状态,带有自适应触发器。当窗户增加时,它们开火良好。但是,如果窗口从最大状态减小到较小状态,则设置器不起作用并且元素将它们的样式重置为默认值,就像它们没有视觉状态一样。
<Grid x:Name="mainGrid" Style="{StaticResource mainGridStyle}">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="largeSize">
<VisualState>
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="1520"/>
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="mainGrid.Background" Value="{StaticResource lgBrush}"/>
<Setter Target="LogoImage.Style" Value="{StaticResource lgLogoStyle}"/>
<Setter Target="TxbClienForStreaming.FontSize" Value="60"/>
<Setter Target="TxbAddText.FontSize" Value="42"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="mediumSize">
<VisualState>
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="600"/>
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="mainGrid.Background" Value="{StaticResource mdBrush}"/>
<Setter Target="LogoImage.Style" Value="{StaticResource mdLogoStyle}"/>
<Setter Target="TxbClienForStreaming.FontSize" Value="45"/>
<Setter Target="TxbAddText.FontSize" Value="28"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="smallSize">
<VisualState>
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="0"/>
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="mainGrid.Background" Value="{StaticResource smBrush}"/>
<Setter Target="TxbClienForStreaming.FontSize" Value="36"/>
<Setter Target="TxbAddText.FontSize" Value="24"/>
<Setter Target="BtnGetNow.FontSize" Value="34"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>