Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change FontWeigth of Window Title in Mahapps.MetroWindow

I can not change Font Weight in MetroWindow Title. How can i do this? I can set FontWeihgt in MetroWindow Attributes, but it affect all controls in my XAML code...

like image 651
Timbioz Avatar asked Nov 14 '15 19:11

Timbioz


1 Answers

You can set the TitleTemplate property of the MetroWindow.

<Controls:MetroWindow.TitleTemplate>
    <DataTemplate>
        <TextBlock Text="{TemplateBinding Content}"
                   TextTrimming="CharacterEllipsis"
                   VerticalAlignment="Center"
                   Margin="8 -1 8 0"
                   FontWeight="Light"
                   FontSize="{DynamicResource WindowTitleFontSize}"
                   FontFamily="{DynamicResource HeaderFontFamily}" />
    </DataTemplate>
</Controls:MetroWindow.TitleTemplate>

Or with upper case for the title:

<Controls:MetroWindow.TitleTemplate>
    <DataTemplate>
        <TextBlock Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Content, Converter={Converters:ToUpperConverter}}"
                   TextTrimming="CharacterEllipsis"
                   VerticalAlignment="Center"
                   Margin="8 -1 8 0"
                   FontWeight="Light"
                   FontSize="{DynamicResource WindowTitleFontSize}"
                   FontFamily="{DynamicResource HeaderFontFamily}" />
    </DataTemplate>
</Controls:MetroWindow.TitleTemplate>
like image 79
punker76 Avatar answered Nov 04 '22 04:11

punker76