Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mahapps - How to set Proper Case in Titles

I am using Mahapps and I am not able to set Proper case for Window titles and Group box titles etc..

I tried googling and Typography settings.

If someone knows out there could you please help-me here..

Thanks

like image 487
Lalitya Avatar asked Dec 15 '13 13:12

Lalitya


3 Answers

New versions:

Window Title

<controls:MetroWindow x:Class="MainWindow"
  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"
  TitleCharacterCasing="Normal" />

GroupBox

Set a style (option 1) or set a property (option 2)

<!-- Option 1 -->
<Style TargetType="{x:Type GroupBox}" BasedOn="{StaticResource MetroGroupBox}">
    <Setter Property="Controls:ControlsHelper.ContentCharacterCasing" Value="Normal" />
</Style>
<!-- Option 2 -->
<GroupBox Controls:ControlsHelper.ContentCharacterCasing="Normal" />

Credits: @Suplanus & @Oscar Vicente Perez


Old versions:

To set window title case:

Set the TitleCaps property on your MetroWindow to false.

<controls:MetroWindow x:Class="MainWindow"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  TitleCaps="False" />

To use title case in groupbox:

Put that TextBlock in the GroupBox's header.

<GroupBox>
  <GroupBox.Header>
    <TextBlock Text="My Group Box"/>
  </GroupBox.Header>
  Some content
</GroupBox>
like image 144
Marcos Avatar answered Nov 03 '22 04:11

Marcos


TitleCaps="False" is obsolete, use this code in the Window:

TitleCharacterCasing="Normal"
like image 45
Suplanus Avatar answered Nov 03 '22 03:11

Suplanus


Completing @Marcos answer:

There are better options than change the Header directly, without losing the Style and Bindings

I had the same problem 2 years after so i'll post my solution. I had to read the code at Git Hub so i realized that the MetroGroupBox Style uses a DependencyProperty in ControlsHelper class named 'ContentCharacterCasing' so we have 2 options, set an style or set the property directly in the control. But before, you need this xmlns in the xaml:

'xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"'

Style Option:

<Style TargetType="{x:Type GroupBox}" BasedOn="{StaticResource MetroGroupBox}">
    <Setter Property="Controls:ControlsHelper.ContentCharacterCasing" Value="Normal" />
</Style>

Control Property Option:

<GroupBox Margin="20,20,20,0" Grid.Row="0" Header="Cliente" Controls:ControlsHelper.ContentCharacterCasing="Normal" />
like image 13
Oscar Vicente Perez Avatar answered Nov 03 '22 03:11

Oscar Vicente Perez