我对 WPF 中按钮上的标签有疑问。单击按钮后,标签变得模糊,然后变得清晰,但它看起来像动画,持续约 2 秒。
<Button Grid.Row="2" Command="{Binding DefaultCommand}">
<StackPanel Orientation="Horizontal">
<Image Source="../Images/add_all.png" />
<TextBlock VerticalAlignment="Center" Margin="2">All</TextBlock>
</StackPanel>
</Button>
我只为 targettype = button 的宽度、高度和边距设置样式。
RenderOptions.ClearTypeHint="ClearTypeHint"
没有帮助。
最佳答案
我认为您看到的只是 Windows 7 上未应用自定义样式的 WPF 按钮的标准行为。单击标准按钮时,将启动动画,将按钮背景从灰色更改为蓝色,然后再变回灰色,持续时间约为 2 秒。当您选择另一个控件时,动画停止。
虽然不确定为什么会看到模糊的标签文本。
您的 PC 上是否禁用了硬件渲染?
关于c# - 单击后按钮上的标签变得模糊,并在 WPF 中恢复动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12780634/