我正在尝试根据 WindowState 属性更新标签的内容。我有以下内容:
<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Window.Resources>
<Style x:Key="StyleMinMax" TargetType="{x:Type Label}">
<Setter Property="TextElement.FontSize" Value="22" />
<Setter Property="TextElement.FontWeight" Value="SemiBold" />
<Setter Property="VerticalAlignment" Value="Stretch" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Foreground" Value="LightSlateGray" />
<Style.Triggers>
<Trigger Property="Window.WindowState" Value="Normal">
<Setter Property="Content" Value="1-Normal" />
</Trigger>
<Trigger Property="Window.WindowState" Value="Maximized">
<Setter Property="Content" Value="2-Maximized" />
</Trigger>
</Style.Triggers>
</Style>
</Window.Resources>
<Grid>
<Label Style="{StaticResource StyleMinMax}"></Label>
</Grid>
</Window>
应用程序启动时标签内容将具有 1-Normal,但是当我最大化我的应用程序时,内容不会改变..任何想法?
提前致谢