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.
MahApps - How to disable automatic uppercase of default button
5.6k views Asked by mababin At
4
There are 4 answers
1

Update for MahApps 2.4.7
<Application
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls">
<Application.Resources>
<ResourceDictionary>
<Style TargetType="{x:Type Button}"
BasedOn="{StaticResource MahApps.Styles.Button}">
<Setter Property="controls:ControlsHelper.ContentCharacterCasing" Value="True"/>
</Style>
</ResourceDictionary>
</Application.Resources>
0

The following line worked for me:
<Setter Property="mah:ControlsHelper.ContentCharacterCasing" Value="Normal"/>
I had to use the namespace "mah" instead of "controls" to match the instructions of the current quick-start guide. It was a bit tricky making it work from fragments of xml as they need to be consistent with other directives in the code. Below is a complete working example.
App.xml:
<Application x:Class="Example.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Example"
xmlns:mah="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
StartupUri="MainWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!-- MahApps.Metro resource dictionaries. Make sure that all file names are Case Sensitive! -->
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
<!-- Theme setting -->
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Themes/Dark.Blue.xaml" />
</ResourceDictionary.MergedDictionaries>
<!-- Change default Button character case from Upper to Normal -->
<Style TargetType="{x:Type Button}" BasedOn="{StaticResource MahApps.Styles.Button}">
<Setter Property="mah:ControlsHelper.ContentCharacterCasing" Value="Normal"/>
</Style>
</ResourceDictionary>
</Application.Resources>
</Application>
MainWindow.xml:
<mah:MetroWindow x:Class="Example.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Example"
mc:Ignorable="d"
xmlns:mah="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
TitleCharacterCasing="Normal"
Title="MainWindow" Height="450" Width="800">
<Grid>
<Button Content="Button" HorizontalAlignment="Left" Margin="92,73,0,0" VerticalAlignment="Top" Height="144" Width="197" FontSize="22" />
</Grid>
</mah:MetroWindow>
2

If you apply the answer of ImaBrokeDude to your App.xaml, it will work for all the buttons in any window of your project.
<Application
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro">
<Application.Resources>
<ResourceDictionary>
<Style TargetType="{x:Type Button}"
BasedOn="{StaticResource {x:Type Button}}">
<Setter Property="controls:ButtonHelper.PreserveTextCase" Value="True"/>
</Style>
</ResourceDictionary>
</Application.Resources>
You can override the default value by setting the property for all buttons in
Window.Resources
Omitting the
x:Key
setting causes the style to be applied to all buttons in thisMetroWindow
.