Question

I am developing an application in WPF using MahApps.Metro 0.12.1. In this application I don't show the titlebar, staying visible minimize, maximize and close commands. Below I show the code:

<controls:MetroWindow xmlns:views="clr-namespace:View.Views"  
    xmlns:titleBar="clr-namespace:View.Views.TitleBar"  
    x:Class="View.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"
    GlowBrush="{DynamicResource AccentColorBrush}"
    ShowWindowCommandsOnTop="False" 
    ShowTitleBar="False"
    Title="MainWindow" Height="400" Width="600"
    AllowsTransparency="False">
<Grid>
    ...
</Grid>

The problem arises when I upgrade to the version 0.13.1 of MathApps.Metro, where these commands are not displayed, forcing me to re-establish the titlebar to display the commands again ShowTitleBar="True" and this is what I do not want: display the titlebar.

I was looking at the release notes of MathApps.Metro 0.13.1 and reports that changes were made to the section of the titlebar​​, but no further details are given.

My questions are: Is there a simple way to display the minimize, maximize and close commands without showing the title bar? What is the best way to do this?

thanks

Was it helpful?

Solution

you can put the window buttons directly in your main window like this

<Grid>
  <!-- the window button commands -->
  <Controls:WindowButtonCommands Panel.ZIndex="1"
                                 HorizontalAlignment="Right"
                                 VerticalAlignment="Top"
                                 Height="{Binding TitlebarHeight, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:MetroWindow}}}" />

    ...
</Grid>

hope that helps

OTHER TIPS

Is there a simple way to display the minimize, maximize and close commands without showing the title bar? What is the best way to do this?

Actually not very simple, but possible. Basically you need to create your own Style template and override the ContentPresenter for your window to do so.

You may take a look at this question.

Besides that, this post will guide you through the process of designing your own titlebar.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top