MahApps.Metro icon indicating copy to clipboard operation
MahApps.Metro copied to clipboard

When ShowTitleBar=False, title bar buttons missing + cannot resize / maximize correctly

Open shadowaltar opened this issue 12 years ago • 9 comments

Hi,

Wish to report an issue in 0.13.0.61-ALPHA (.net4, under Client Profile).

In previous build 0.12.1, I can see the max/min/restore/close buttons on the upper right side of window even the titlebar is hidden (also the MetroWindow.WindowCommands). Would you please restore them back?

Also, if titlebar is hidden, the window cannot maximize (by doubleclicking the hidden title area, or drag the window to the upper border of windows7 screen) / resize correctly.

I am not sure whether ShowWindowCommandsOnTop works or not.. also no obvious effect after removing the BorderThickness.

My metro-window in xaml looks like this:

<controls:MetroWindow x:Class="MyProgram.Views.MainView"
                      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"
                      xmlns:cal="http://www.caliburnproject.org"
                      ShowTitleBar="False" ShowWindowCommandsOnTop="True"
                      GlowBrush="{StaticResource HighlightBrush}"
                      Height="600" Width="1050" BorderThickness="1">
....

Thanks!

shadowaltar avatar Mar 19 '14 06:03 shadowaltar

i'm looking into this, the idea was, if titlebar is hidden, the window is a window without a titlebar, without doubleclick on a hidden titlebar... why? for this, use the clean style, maybe without a title, so you get what you want.

the ShowWindowCommandsOnTop will be fixed...

punker76 avatar Mar 19 '14 07:03 punker76

@shadowaltar so, i found the bug with "cannot maximize (by doubleclicking the hidden title area" i'll fix this soon

punker76 avatar Mar 19 '14 10:03 punker76

@shadowaltar the maximizing bug is fixed with #1173 so the other stuff

In previous build 0.12.1, I can see the max/min/restore/close buttons on the upper right side of window even the titlebar is hidden (also the MetroWindow.WindowCommands)

i would prefer that is a feature and before it was a bug to show the buttons and commands...

punker76 avatar Mar 19 '14 10:03 punker76

@punker76 thanks a lot for your very very quick response!

I do want to have the previous behavior (0.12) such that only hides the title string and icon:

  1. no icon
  2. no windows title (cuz i have my customized bigger window title like the "Start" in win8 metro launcher)
  3. show max/min/restore/close buttons and the Windows.Commands
  4. (a subtle point) windows taskbar shows the window title..

In 0.13 if i set ShowIconOnTitleBar="False", Title="", Style="{DynamicResource CleanWindowStyleKey}", I'll get almost everything I want except point 4 :(

Thanks!

shadowaltar avatar Mar 20 '14 03:03 shadowaltar

I've implemented my own solution: adding a new property to the MetroWindow and toggle the visibility of title bar's text in the CleanWindow.xaml resource file.

In CleanWindow.xaml, add this to the element with x:Name=TitleControl

    Visibility="{TemplateBinding ShowTitleText, Converter={StaticResource BooleanToVisibilityConverter}}"

In MetroWindow.cs

    public static readonly DependencyProperty ShowTitleTextProperty = DependencyProperty.Register("ShowTitleText", typeof(bool), typeof(MetroWindow), new PropertyMetadata(true, null, OnShowTitleBarCoerceValueCallback)); // same criteria as ShowTitleBar

        /// <summary>
        /// Gets/sets whether the text of TitleBar is visible or not.
        /// </summary>
        public bool ShowTitleText
        {
            get { return (bool)GetValue(ShowTitleTextProperty); }
            set { SetValue(ShowTitleTextProperty, value); }
        }

(dumb question) how should i contribute / give it to someone to review? :p

shadowaltar avatar Mar 26 '14 03:03 shadowaltar

@shadowaltar Create a pull request for it

flagbug avatar Mar 26 '14 14:03 flagbug

@shadowaltar But instead of introducing a new property, wouldn't it be easier to just set the text to an empty string?

flagbug avatar Mar 26 '14 14:03 flagbug

@flagbug as i mentioned, set it empty will cause the taskbar's window name be empty too.

shadowaltar avatar Mar 26 '14 15:03 shadowaltar

@shadowaltar Ah, you're right, I missed that

flagbug avatar Mar 26 '14 15:03 flagbug