When ShowTitleBar=False, title bar buttons missing + cannot resize / maximize correctly
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!
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...
@shadowaltar so, i found the bug with "cannot maximize (by doubleclicking the hidden title area" i'll fix this soon
@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 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:
- no icon
- no windows title (cuz i have my customized bigger window title like the "Start" in win8 metro launcher)
- show max/min/restore/close buttons and the Windows.Commands
- (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!
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 Create a pull request for it
@shadowaltar But instead of introducing a new property, wouldn't it be easier to just set the text to an empty string?
@flagbug as i mentioned, set it empty will cause the taskbar's window name be empty too.
@shadowaltar Ah, you're right, I missed that