fixed a bug of window
This commit is contained in:
1 parent
89319eadee
commit
437b454c83
1 file changed
+12
-2
@@ -64,7 +64,7 @@ namespace HandyControl.Controls
|
|||||||
|
|
||||||
public static readonly DependencyProperty NonClientAreaHeightProperty = DependencyProperty.Register(
|
public static readonly DependencyProperty NonClientAreaHeightProperty = DependencyProperty.Register(
|
||||||
"NonClientAreaHeight", typeof(double), typeof(Window),
|
"NonClientAreaHeight", typeof(double), typeof(Window),
|
||||||
new PropertyMetadata(28.0));
|
new PropertyMetadata(26.0));
|
||||||
|
|
||||||
public static readonly DependencyProperty ShowNonClientAreaProperty = DependencyProperty.Register(
|
public static readonly DependencyProperty ShowNonClientAreaProperty = DependencyProperty.Register(
|
||||||
"ShowNonClientArea", typeof(bool), typeof(Window),
|
"ShowNonClientArea", typeof(bool), typeof(Window),
|
||||||
@@ -288,19 +288,25 @@ namespace HandyControl.Controls
|
|||||||
if (WindowState == WindowState.Maximized)
|
if (WindowState == WindowState.Maximized)
|
||||||
{
|
{
|
||||||
BorderThickness = new Thickness();
|
BorderThickness = new Thickness();
|
||||||
|
_tempNonClientAreaHeight = NonClientAreaHeight;
|
||||||
|
NonClientAreaHeight += 8;
|
||||||
}
|
}
|
||||||
else if (WindowState == WindowState.Normal)
|
else if (WindowState == WindowState.Normal)
|
||||||
{
|
{
|
||||||
BorderThickness = _actualBorderThickness;
|
BorderThickness = _actualBorderThickness;
|
||||||
|
NonClientAreaHeight = _tempNonClientAreaHeight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void OnLoaded(RoutedEventArgs args)
|
protected void OnLoaded(RoutedEventArgs args)
|
||||||
{
|
{
|
||||||
_actualBorderThickness = BorderThickness;
|
_actualBorderThickness = BorderThickness;
|
||||||
|
_tempNonClientAreaHeight = NonClientAreaHeight;
|
||||||
|
|
||||||
if (WindowState == WindowState.Maximized)
|
if (WindowState == WindowState.Maximized)
|
||||||
{
|
{
|
||||||
BorderThickness = new Thickness();
|
BorderThickness = new Thickness();
|
||||||
|
_tempNonClientAreaHeight += 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandBindings.Add(new CommandBinding(SystemCommands.MinimizeWindowCommand,
|
CommandBindings.Add(new CommandBinding(SystemCommands.MinimizeWindowCommand,
|
||||||
@@ -312,7 +318,6 @@ namespace HandyControl.Controls
|
|||||||
CommandBindings.Add(new CommandBinding(SystemCommands.CloseWindowCommand, (s, e) => Close()));
|
CommandBindings.Add(new CommandBinding(SystemCommands.CloseWindowCommand, (s, e) => Close()));
|
||||||
CommandBindings.Add(new CommandBinding(SystemCommands.ShowSystemMenuCommand, ShowSystemMenu));
|
CommandBindings.Add(new CommandBinding(SystemCommands.ShowSystemMenuCommand, ShowSystemMenu));
|
||||||
|
|
||||||
_tempNonClientAreaHeight = NonClientAreaHeight;
|
|
||||||
_tempWindowState = WindowState;
|
_tempWindowState = WindowState;
|
||||||
_tempWindowStyle = WindowStyle;
|
_tempWindowStyle = WindowStyle;
|
||||||
_tempResizeMode = ResizeMode;
|
_tempResizeMode = ResizeMode;
|
||||||
@@ -320,6 +325,11 @@ namespace HandyControl.Controls
|
|||||||
SwitchIsFullScreen(_isFullScreen);
|
SwitchIsFullScreen(_isFullScreen);
|
||||||
SwitchShowNonClientArea(_showNonClientArea);
|
SwitchShowNonClientArea(_showNonClientArea);
|
||||||
|
|
||||||
|
if (WindowState == WindowState.Maximized)
|
||||||
|
{
|
||||||
|
_tempNonClientAreaHeight -= 8;
|
||||||
|
}
|
||||||
|
|
||||||
if (SizeToContent != SizeToContent.WidthAndHeight)
|
if (SizeToContent != SizeToContent.WidthAndHeight)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user