MahApps - 如何禁用默认按钮的自动大写 [英] MahApps - How to disable automatic uppercase of default button
本文介绍了MahApps - 如何禁用默认按钮的自动大写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经开始在我的 WPF 应用程序中引入 MahApps.Metro(真的很棒),我最喜欢的按钮是默认的.问题是它把我所有的文本都大写,而我不想要它.
I have started to introduce MahApps.Metro (really awesome) in my WPF application and my favorite button is the default. The problem is that it puts all my text in uppercase and I don't want it.
推荐答案
您可以通过为 Window.Resources
<controls:MetroWindow
...
xmlns:controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Window.Resources>
<ResourceDictionary>
<Style TargetType="{x:Type Button}"
BasedOn="{StaticResource {x:Type Button}}">
<Setter Property="controls:ButtonHelper.PreserveTextCase" Value="True"/>
</Style>
</ResourceDictionary>
</Window.Resources>
<Grid>
<!-- This would have normally made the text uppercase if not for the style override -->
<Button Content="Button"/>
</Grid>
</controls:MetroWindow>
省略 x:Key
设置会导致样式应用于此 MetroWindow
中的所有按钮.
Omitting the x:Key
setting causes the style to be applied to all buttons in this MetroWindow
.
这篇关于MahApps - 如何禁用默认按钮的自动大写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文