Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
41fec83
Don't fire TransitioningContentControl's TransitionCompleted twice
punker76 Jan 27, 2017
6cccfcd
Fix breaking change for obsolete properties
punker76 Jan 27, 2017
e57527d
Fix binding to Content of HamburgerMenu
punker76 Jan 27, 2017
eb7cd4b
Correct display of media buttons in HotKeyBox (#2814)
thoemmi Jan 27, 2017
224c283
Merge branch 'develop' into 2817-TransitioningContentControl-Transiti…
punker76 Jan 27, 2017
e0a01ef
Merge branch '2817-TransitioningContentControl-TransitionCompleted-fi…
punker76 Jan 27, 2017
5d05416
Merge remote-tracking branch 'origin/develop' into punker76-ButtonHel…
punker76 Jan 27, 2017
75a3d0e
Fix obsolete ButtonWidth property
punker76 Jan 27, 2017
7fcc6b7
Merge branch 'punker76-ButtonHelper-breaking-change-fix' into develop
punker76 Jan 27, 2017
ae0f648
Merge remote-tracking branch 'origin/develop' into punker76-Hamburger…
punker76 Jan 27, 2017
a1d199d
Merge branch 'punker76-HamburgerMenu-Content-Binding-fix' into develop
punker76 Jan 27, 2017
f158ed4
[Fix] Issue where SelectedDate is set to the DisplayDate if the Selec…
michaelmairegger Jan 27, 2017
340c436
add 1.4.2 release notes
punker76 Jan 27, 2017
0b7195b
Fix #2804
punker76 Jan 28, 2017
2d327a7
Fix #2823
punker76 Jan 28, 2017
2574c17
Fix #2815
punker76 Jan 28, 2017
ae9249b
Fix #2770
punker76 Jan 28, 2017
362d629
Fix wrong z-Order caused by ignoring Taskbar fix
punker76 Jan 30, 2017
e6e062e
Use internal GetPhysicalCursorPos
punker76 Jan 30, 2017
97af851
Set version to 1.4.2
punker76 Jan 30, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions docs/release-notes/1.4.2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# 1.4.2 Notes

## Changes / Fixes

- [#2814](https://github.com/MahApps/MahApps.Metro/pull/2814) Correct display of media buttons in `HotKeyBox` (thx @thoemmi)
- [7fcc6b7](https://github.com/MahApps/MahApps.Metro/commit/7fcc6b770c77f483eb038705b252cfa7624a343f) Fix breaking changes for obsolete properties `ButtonHelper.PreserveTextCase`, `ButtonHelper.CornerRadius` and `ControlsHelper.ButtonWidth`
- [a1d199d](https://github.com/MahApps/MahApps.Metro/commit/a1d199dd599fa9f46838d6449599b36c7035f76e) Fix binding to Content of HamburgerMenu
- [#2799](https://github.com/MahApps/MahApps.Metro/pull/2799) DateTimePicker SelectedDate issue (thx @xxMUROxx)
+ Fix issue where `SelectedDate` is set to the `DisplayDate` if the `SelectedDate` is `DateTime.MinValue`. This issue appears when binding to a property of DateTime and the date is `DateTime.MinValue`.
- Z-Order was wrong if `MetroWindow` is ignoring the Taskbar and maximized. This fix and the main Taskbar z-Order issue only happens with Windows 10 anniversary update 1607. Hopefully fixed in the future. [#2780](https://github.com/MahApps/MahApps.Metro/issues/2780)
- Use internal GetPhysicalCursorPos instead GetCursorPos (tested with remote desktop and different DPI) [#2748](https://github.com/MahApps/MahApps.Metro/issues/2748)

## Closed Issues

- [#2585](https://github.com/MahApps/MahApps.Metro/issues/2585) HotKeyBox gives wrong names to multimedia buttons
- [#2817](https://github.com/MahApps/MahApps.Metro/issues/2817) TransitioningContentControl's TransitionCompleted event fires twice
- [#2804](https://github.com/MahApps/MahApps.Metro/issues/2804) TransitionsEnabled=false NullpointerException
- [#2823](https://github.com/MahApps/MahApps.Metro/issues/2823) Issue with ClearTextButton on TextBox
- [#2815](https://github.com/MahApps/MahApps.Metro/issues/2815) Layout issue with TabControl, TabStripPlacement Left, TabControlHelper.IsUnderlined="True"
- [#2770](https://github.com/MahApps/MahApps.Metro/issues/2770) Increase Win10 ToggleSwitch Default Margins
- [#2780](https://github.com/MahApps/MahApps.Metro/issues/2780) External Dialogs not visible with MainWindow set to IgnoreTaskbarOnMaximize
- [#2748](https://github.com/MahApps/MahApps.Metro/issues/2748) Access Denied
2 changes: 1 addition & 1 deletion src/MahApps.Metro.Build/MahApps.Metro.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/10/nuspec.xsd">
<metadata>
<id>MahApps.Metro</id>
<version>1.4.1.0</version>
<version>1.4.2.0</version>
<title>MahApps.Metro</title>
<authors>Jan Karger, Dennis Daume, Brendan Forster, Paul Jenkins, Jake Ginnivan, Alex Mitchell</authors>
<owners>punker76,shiftkey,aeoth,jakeginnivan</owners>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
Margin="20"
Foreground="White"
HamburgerWidth="48"
Content="{Binding RelativeSource={RelativeSource Self}, Mode=OneWay, Path=SelectedItem}"
ItemClick="HamburgerMenu_OnItemClick"
ItemTemplate="{StaticResource HamburgerMenuImageItem}"
OptionsItemClick="HamburgerMenu_OnOptionsItemClick"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,15 @@ public HamburgerMenuSample()

private void HamburgerMenu_OnItemClick(object sender, ItemClickEventArgs e)
{
HamburgerMenuControl.Content = e.ClickedItem;
// instead using binding Content="{Binding RelativeSource={RelativeSource Self}, Mode=OneWay, Path=SelectedItem}"
// we can do this
//HamburgerMenuControl.Content = e.ClickedItem;

// close the menu if a item was selected
if (this.HamburgerMenuControl.IsPaneOpen)
{
this.HamburgerMenuControl.IsPaneOpen = false;
}
}

private async void HamburgerMenu_OnOptionsItemClick(object sender, ItemClickEventArgs e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,23 +104,24 @@
<Grid.Resources>
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.AnimatedSingleRowTabControl.xaml" />
</Grid.Resources>
<TabControl Height="100"
<TabControl Height="200"
Margin="0, 10, 0, 0"
Controls:TabControlHelper.IsUnderlined="True"
TabStripPlacement="Left">
<TabItem Header="LeftItem0">
<TextBlock FontSize="30" Text="This is left content 0" />
<TabItem Header="LeftItem 0">
<TextBlock FontSize="24" Text="This is left content 0" />
</TabItem>
<TabItem Header="LeftItem1">
<TextBlock FontSize="30" Text="This is left content 1" />
<TabItem Header="LeftItem 1 Header">
<TextBlock FontSize="24" Text="This is left content 1" />
</TabItem>
<TabItem Header="LeftItem2">
<TextBlock FontSize="30" Text="This is left content 2" />
<TabItem Header="LeftItem 2 Text">
<TextBlock FontSize="24" Text="This is left content 2" />
</TabItem>
<TabItem Header="LeftItem3">
<TextBlock FontSize="30" Text="This is left content 3" />
<TabItem Header="LeftItem 3">
<TextBlock FontSize="24" Text="This is left content 3" />
</TabItem>
<TabItem Header="LeftItem4">
<TextBlock FontSize="30" Text="This is left content 4" />
<TabItem Header="LeftItem 4">
<TextBlock FontSize="24" Text="This is left content 4" />
</TabItem>
</TabControl>
</Grid>
Expand Down Expand Up @@ -274,6 +275,30 @@
<TextBlock FontSize="24" Text="The size of close button will be changed proportionately considering its header size." />
</Controls:MetroTabItem>
</Controls:MetroTabControl>

<Label Margin="0, 5, 0, 0"
Content="MetroTabControl _left style"
Style="{DynamicResource DescriptionHeaderStyle}" />
<Controls:MetroTabControl Height="220"
Margin="0, 10, 0, 0"
Controls:TabControlHelper.IsUnderlined="True"
TabStripPlacement="Left">
<Controls:MetroTabItem Header="LeftItem 0">
<TextBlock FontSize="24" Text="This is left content 0" />
</Controls:MetroTabItem>
<Controls:MetroTabItem Header="LeftItem 1 Header">
<TextBlock FontSize="24" Text="This is left content 1" />
</Controls:MetroTabItem>
<Controls:MetroTabItem Header="LeftItem 2 Text">
<TextBlock FontSize="24" Text="This is left content 2" />
</Controls:MetroTabItem>
<Controls:MetroTabItem Header="LeftItem 3" CloseButtonEnabled="True">
<TextBlock FontSize="24" Text="This is left content 3" />
</Controls:MetroTabItem>
<Controls:MetroTabItem Header="LeftItem 4">
<TextBlock FontSize="24" Text="This is left content 4" />
</Controls:MetroTabItem>
</Controls:MetroTabControl>
</StackPanel>
</Expander>
</StackPanel>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,6 @@
Margin="{StaticResource ColumnMargin}">
<Label Style="{DynamicResource DescriptionHeaderStyle}" Content="HotKeyBox" />
<Controls:HotKeyBox Margin="{StaticResource ControlMargin}"
Controls:ControlsHelper.ContentCharacterCasing="Upper"
AreModifierKeysRequired="{Binding ElementName=ModifierKeysRequired, Path=IsChecked}"
HotKey="{Binding HotKey, ValidatesOnDataErrors=True, UpdateSourceTrigger=PropertyChanged, NotifyOnValidationError=True}"
Watermark="Enter hot key" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ protected override void OnAttached()
this.AssociatedObject.Deactivated += (sender, args) => { topmostHack(); };

this.AssociatedObject.Loaded += this.AssociatedObject_Loaded;
this.AssociatedObject.Unloaded += this.AssociatedObject_Unloaded;
this.AssociatedObject.Unloaded += this.AssociatedObjectUnloaded;
this.AssociatedObject.Closed += this.AssociatedObjectClosed;
this.AssociatedObject.SourceInitialized += this.AssociatedObject_SourceInitialized;
this.AssociatedObject.StateChanged += this.OnAssociatedObjectHandleMaximize;

Expand Down Expand Up @@ -229,6 +230,11 @@ private void Cleanup()
{
this.isCleanedUp = true;

if (GetHandleTaskbar(this.AssociatedObject) && this.isWindwos10OrHigher)
{
this.DeactivateTaskbarFix();
}

// clean up events
if (this.AssociatedObject is MetroWindow)
{
Expand All @@ -238,7 +244,8 @@ private void Cleanup()
.RemoveValueChanged(this.AssociatedObject, this.UseNoneWindowStylePropertyChangedCallback);
}
this.AssociatedObject.Loaded -= this.AssociatedObject_Loaded;
this.AssociatedObject.Unloaded -= this.AssociatedObject_Unloaded;
this.AssociatedObject.Unloaded -= this.AssociatedObjectUnloaded;
this.AssociatedObject.Closed -= this.AssociatedObjectClosed;
this.AssociatedObject.SourceInitialized -= this.AssociatedObject_SourceInitialized;
this.AssociatedObject.StateChanged -= this.OnAssociatedObjectHandleMaximize;
if (this.hwndSource != null)
Expand All @@ -255,7 +262,12 @@ protected override void OnDetaching()
base.OnDetaching();
}

private void AssociatedObject_Unloaded(object sender, RoutedEventArgs e)
private void AssociatedObjectUnloaded(object sender, RoutedEventArgs e)
{
this.Cleanup();
}

private void AssociatedObjectClosed(object sender, EventArgs e)
{
this.Cleanup();
}
Expand Down Expand Up @@ -315,34 +327,17 @@ private void HandleMaximize()
var monitorInfo = new MONITORINFO();
UnsafeNativeMethods.GetMonitorInfo(monitor, monitorInfo);

if (ignoreTaskBar)
var x = monitorInfo.rcMonitor.left;
var y = monitorInfo.rcMonitor.top;
var cx = Math.Abs(monitorInfo.rcMonitor.right - x);
var cy = Math.Abs(monitorInfo.rcMonitor.bottom - y);

if (ignoreTaskBar && this.isWindwos10OrHigher)
{
var x = monitorInfo.rcMonitor.left;
var y = monitorInfo.rcMonitor.top;
var cx = Math.Abs(monitorInfo.rcMonitor.right - x);
var cy = Math.Abs(monitorInfo.rcMonitor.bottom - y);

var trayHWND = Standard.NativeMethods.FindWindow("Shell_TrayWnd", null);
if (this.isWindwos10OrHigher && trayHWND != IntPtr.Zero)
{
UnsafeNativeMethods.SetWindowPos(this.handle, trayHWND, x, y, cx, cy, 0x0040);
Standard.NativeMethods.ShowWindow(this.handle, Standard.SW.HIDE);
Standard.NativeMethods.ShowWindow(this.handle, Standard.SW.SHOW);
}
else
{
UnsafeNativeMethods.SetWindowPos(this.handle, new IntPtr(-2), x, y, cx, cy, 0x0040);
}
this.ActivateTaskbarFix();
}
else
{
var x = monitorInfo.rcWork.left;
var y = monitorInfo.rcWork.top;
var cx = Math.Abs(monitorInfo.rcWork.right - x);
var cy = Math.Abs(monitorInfo.rcWork.bottom - y);

UnsafeNativeMethods.SetWindowPos(this.handle, new IntPtr(-2), x, y, cx, cy, 0x0040);
}
UnsafeNativeMethods.SetWindowPos(this.handle, new IntPtr(-2), x, y, cx, cy, 0x0040);
}
}
}
Expand All @@ -360,23 +355,9 @@ private void HandleMaximize()

// #2694 make sure the window is not on top after restoring window
// this issue was introduced after fixing the windows 10 bug with the taskbar and a maximized window that ignores the taskbar
RECT rect;
if (UnsafeNativeMethods.GetWindowRect(this.handle, out rect))
if (GetHandleTaskbar(this.AssociatedObject) && this.isWindwos10OrHigher)
{
var left = rect.left;
var top = rect.top;
var width = rect.Width;
var height = rect.Height;

// #2780 Don't blindly set the Z-Order to HWWND_NOTOPMOST. If this window has an owner, set
// the Z-Order to be after the owner. This keeps external dialogs appearing correctly above
// their owner window even when owner window is maximized and ignoring taskbar.
IntPtr hwndInsAfter = Constants.HWND_NOTOPMOST;
if (this.AssociatedObject.Owner != null)
{
hwndInsAfter = new WindowInteropHelper(this.AssociatedObject.Owner).Handle;
}
UnsafeNativeMethods.SetWindowPos(this.handle, hwndInsAfter, left, top, width, height, 0x0040);
this.DeactivateTaskbarFix();
}
}

Expand All @@ -401,6 +382,46 @@ private void HandleMaximize()
this.topMostChangeNotifier.RaiseValueChanged = raiseValueChanged;
}

private void ActivateTaskbarFix()
{
var trayWndHandle = Standard.NativeMethods.FindWindow("Shell_TrayWnd", null);
if (trayWndHandle != IntPtr.Zero)
{
SetHandleTaskbar(this.AssociatedObject, true);
UnsafeNativeMethods.SetWindowPos(trayWndHandle, Constants.HWND_BOTTOM, 0, 0, 0, 0, Constants.TOPMOST_FLAGS);
UnsafeNativeMethods.SetWindowPos(trayWndHandle, Constants.HWND_TOP, 0, 0, 0, 0, Constants.TOPMOST_FLAGS);
UnsafeNativeMethods.SetWindowPos(trayWndHandle, Constants.HWND_NOTOPMOST, 0, 0, 0, 0, Constants.TOPMOST_FLAGS);
}
}

private void DeactivateTaskbarFix()
{
var trayWndHandle = Standard.NativeMethods.FindWindow("Shell_TrayWnd", null);
if (trayWndHandle != IntPtr.Zero)
{
SetHandleTaskbar(this.AssociatedObject, false);
UnsafeNativeMethods.SetWindowPos(trayWndHandle, Constants.HWND_BOTTOM, 0, 0, 0, 0, Constants.TOPMOST_FLAGS);
UnsafeNativeMethods.SetWindowPos(trayWndHandle, Constants.HWND_TOP, 0, 0, 0, 0, Constants.TOPMOST_FLAGS);
UnsafeNativeMethods.SetWindowPos(trayWndHandle, Constants.HWND_TOPMOST, 0, 0, 0, 0, Constants.TOPMOST_FLAGS);
}
}

private static readonly DependencyProperty HandleTaskbarProperty
= DependencyProperty.RegisterAttached(
"HandleTaskbar",
typeof(bool),
typeof(BorderlessWindowBehavior), new FrameworkPropertyMetadata(false));

private static bool GetHandleTaskbar(UIElement element)
{
return (bool)element.GetValue(HandleTaskbarProperty);
}

private static void SetHandleTaskbar(UIElement element, bool value)
{
element.SetValue(HandleTaskbarProperty, value);
}

private void AssociatedObject_SourceInitialized(object sender, EventArgs e)
{
this.handle = new WindowInteropHelper(this.AssociatedObject).Handle;
Expand Down
15 changes: 2 additions & 13 deletions src/MahApps.Metro/MahApps.Metro.Shared/Controls/GlowWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref b
case WM.LBUTTONDOWN:
if (this.ownerHandle != IntPtr.Zero && UnsafeNativeMethods.GetWindowRect(this.ownerHandle, out rect))
{
var pt = this.GetRelativeMousePosition();
var pt = WinApiHelper.GetRelativeMousePosition(this.handle);
NativeMethods.PostMessage(this.ownerHandle, (uint)WM.NCLBUTTONDOWN, (IntPtr)this.getHitTestValue(pt, rect), IntPtr.Zero);
}
break;
Expand All @@ -313,7 +313,7 @@ private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref b
{
if (this.ownerHandle != IntPtr.Zero && UnsafeNativeMethods.GetWindowRect(this.ownerHandle, out rect))
{
var pt = this.GetRelativeMousePosition();
var pt = WinApiHelper.GetRelativeMousePosition(this.handle);
cursor = this.getCursor(pt, rect);
}
}
Expand All @@ -325,16 +325,5 @@ private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref b
}
return IntPtr.Zero;
}

private Point GetRelativeMousePosition()
{
if (this.handle == IntPtr.Zero)
{
return new Point();
}
var point = Standard.NativeMethods.GetCursorPos();
Standard.NativeMethods.ScreenToClient(this.handle, ref point);
return new Point(point.x, point.y);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public override void OnApplyTemplate()

private void HamburgerMenu_Loaded(object sender, RoutedEventArgs e)
{
this.Content = _buttonsListView?.SelectedItem ?? _optionsListView?.SelectedItem;
this.SetCurrentValue(ContentProperty, _buttonsListView?.SelectedItem ?? _optionsListView?.SelectedItem);
}
}
}
Loading