Skip to content

Commit 6c1dd3d

Browse files
authored
Merge pull request #2798 from MahApps/develop
Merging content of 1.4.1 develop to master
2 parents 225d55a + 2353ecc commit 6c1dd3d

File tree

13 files changed

+124
-66
lines changed

13 files changed

+124
-66
lines changed

docs/release-notes/1.4.1.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# 1.4.1 Notes
2+
3+
## Changes / Fixes
4+
5+
- [#2793](https://github.com/MahApps/MahApps.Metro/pull/2793) StringToVisibilityConverter should handle null like an empty string
6+
- [#2796](https://github.com/MahApps/MahApps.Metro/pull/2796) HamburgerMenu SelectedIndex Fix
7+
- [#2797](https://github.com/MahApps/MahApps.Metro/pull/2797) Fix NumericUpDown using UseFloatingWatermark
8+
- [#2789](https://github.com/MahApps/MahApps.Metro/pull/2789) Prevent the MetroDataGridCheckBox from being toggled by a TAB + SPACE when the cell is supposed to be read only.
9+
10+
## Closed Issues
11+
12+
- [#2795](https://github.com/MahApps/MahApps.Metro/issues/2795) NumericUpDown Watermark is shown twice when using floatingwatermark for textboxes
13+
- [#2788](https://github.com/MahApps/MahApps.Metro/issues/2788) MetroDataGridCheckBox cell can be changed when IsReadOnly via keyboard + space
14+
- [#2785](https://github.com/MahApps/MahApps.Metro/issues/2785) Vailidation tooltips does not show.
15+
- [#2780](https://github.com/MahApps/MahApps.Metro/issues/2780) External Dialogs not visible with MainWindow set to IgnoreTaskbarOnMaximize

src/MahApps.Metro.Build/MahApps.Metro.nuspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package xmlns="http://schemas.microsoft.com/packaging/2011/10/nuspec.xsd">
33
<metadata>
44
<id>MahApps.Metro</id>
5-
<version>1.4.0.0</version>
5+
<version>1.4.1.0</version>
66
<title>MahApps.Metro</title>
77
<authors>Jan Karger, Dennis Daume, Brendan Forster, Paul Jenkins, Jake Ginnivan, Alex Mitchell</authors>
88
<owners>punker76,shiftkey,aeoth,jakeginnivan</owners>
@@ -13,7 +13,7 @@
1313
<description>The goal of MahApps.Metro is to allow devs to quickly and easily cobble together a "Metro" or "Modern UI" for their WPF4+ apps, with minimal effort.</description>
1414
<summary>The goal of MahApps.Metro is to allow devs to quickly and easily cobble together a "Metro" or "Modern UI" for their WPF4+ apps, with minimal effort.</summary>
1515
<releaseNotes />
16-
<tags>WPF UI Metro ModernUI Material XAML Toolkit Library .NET</tags>
16+
<tags>WPF UI Metro Modern Material XAML Toolkit Library .NET</tags>
1717
</metadata>
1818
<files>
1919
<file src="..\bin\MahApps.Metro\ReleaseNET40\MahApps.Metro.dll" target="lib\net40\MahApps.Metro.dll" />

src/MahApps.Metro.Samples/MahApps.Metro.Demo/MahApps.Metro.Demo.Shared/ExampleViews/HamburgerMenuSample.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151

5252
<Grid>
5353
<controls:HamburgerMenu x:Name="HamburgerMenuControl"
54+
SelectedIndex="1"
5455
Margin="20"
5556
Foreground="White"
5657
HamburgerWidth="48"

src/MahApps.Metro/MahApps.Metro.Shared/Behaviours/BorderlessWindowBehavior.cs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -368,12 +368,15 @@ private void HandleMaximize()
368368
var width = rect.Width;
369369
var height = rect.Height;
370370

371-
// Z-Order would only get refreshed/reflected if clicking the
372-
// the titlebar (as opposed to other parts of the external
373-
// window) unless I first set the window to HWND_BOTTOM then HWND_TOP before HWND_NOTOPMOST
374-
UnsafeNativeMethods.SetWindowPos(this.handle, Constants.HWND_BOTTOM, left, top, width, height, Constants.TOPMOST_FLAGS);
375-
UnsafeNativeMethods.SetWindowPos(this.handle, Constants.HWND_TOP, left, top, width, height, Constants.TOPMOST_FLAGS);
376-
UnsafeNativeMethods.SetWindowPos(this.handle, Constants.HWND_NOTOPMOST, left, top, width, height, Constants.TOPMOST_FLAGS);
371+
// #2780 Don't blindly set the Z-Order to HWWND_NOTOPMOST. If this window has an owner, set
372+
// the Z-Order to be after the owner. This keeps external dialogs appearing correctly above
373+
// their owner window even when owner window is maximized and ignoring taskbar.
374+
IntPtr hwndInsAfter = Constants.HWND_NOTOPMOST;
375+
if (this.AssociatedObject.Owner != null)
376+
{
377+
hwndInsAfter = new WindowInteropHelper(this.AssociatedObject.Owner).Handle;
378+
}
379+
UnsafeNativeMethods.SetWindowPos(this.handle, hwndInsAfter, left, top, width, height, 0x0040);
377380
}
378381
}
379382

src/MahApps.Metro/MahApps.Metro.Shared/Controls/HamburgerMenu/HamburgerMenu.Options.cs

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,26 @@ public partial class HamburgerMenu
1919
/// </summary>
2020
public static readonly DependencyProperty OptionsItemTemplateProperty = DependencyProperty.Register(nameof(OptionsItemTemplate), typeof(DataTemplate), typeof(HamburgerMenu), new PropertyMetadata(null));
2121

22+
/// <summary>
23+
/// Identifies the <see cref="OptionsItemTemplateSelector"/> dependency property.
24+
/// </summary>
25+
public static readonly DependencyProperty OptionsItemTemplateSelectorProperty = DependencyProperty.Register(nameof(OptionsItemTemplateSelector), typeof(DataTemplateSelector), typeof(HamburgerMenu), new PropertyMetadata(null));
26+
2227
/// <summary>
2328
/// Identifies the <see cref="OptionsVisibility"/> dependency property.
2429
/// </summary>
2530
public static readonly DependencyProperty OptionsVisibilityProperty = DependencyProperty.Register(nameof(OptionsVisibility), typeof(Visibility), typeof(HamburgerMenu), new PropertyMetadata(Visibility.Visible));
2631

32+
/// <summary>
33+
/// Identifies the <see cref="SelectedOptionsItem"/> dependency property.
34+
/// </summary>
35+
public static readonly DependencyProperty SelectedOptionsItemProperty = DependencyProperty.Register(nameof(SelectedOptionsItem), typeof(object), typeof(HamburgerMenu), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));
36+
37+
/// <summary>
38+
/// Identifies the <see cref="SelectedOptionsIndex"/> dependency property.
39+
/// </summary>
40+
public static readonly DependencyProperty SelectedOptionsIndexProperty = DependencyProperty.Register(nameof(SelectedOptionsIndex), typeof(int), typeof(HamburgerMenu), new FrameworkPropertyMetadata(-1, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault | FrameworkPropertyMetadataOptions.Journal));
41+
2742
/// <summary>
2843
/// Gets or sets an object source used to generate the content of the options.
2944
/// </summary>
@@ -42,6 +57,15 @@ public DataTemplate OptionsItemTemplate
4257
set { SetValue(OptionsItemTemplateProperty, value); }
4358
}
4459

60+
/// <summary>
61+
/// Gets or sets the DataTemplateSelector used to display each item in the options.
62+
/// </summary>
63+
public DataTemplateSelector OptionsItemTemplateSelector
64+
{
65+
get { return (DataTemplateSelector)GetValue(OptionsItemTemplateSelectorProperty); }
66+
set { SetValue(OptionsItemTemplateSelectorProperty, value); }
67+
}
68+
4569
/// <summary>
4670
/// Gets the collection used to generate the content of the option list.
4771
/// </summary>
@@ -75,17 +99,17 @@ public Visibility OptionsVisibility
7599
/// </summary>
76100
public object SelectedOptionsItem
77101
{
78-
get { return _optionsListView.SelectedItem; }
79-
set { _optionsListView.SelectedItem = value; }
102+
get { return GetValue(SelectedOptionsItemProperty); }
103+
set { SetValue(SelectedOptionsItemProperty, value); }
80104
}
81105

82106
/// <summary>
83107
/// Gets or sets the selected options menu index.
84108
/// </summary>
85109
public int SelectedOptionsIndex
86110
{
87-
get { return _optionsListView.SelectedIndex; }
88-
set { _optionsListView.SelectedIndex = value; }
111+
get { return (int)GetValue(SelectedOptionsIndexProperty); }
112+
set { SetValue(SelectedOptionsIndexProperty, value); }
89113
}
90114
}
91115
}

src/MahApps.Metro/MahApps.Metro.Shared/Controls/HamburgerMenu/HamburgerMenu.Properties.cs

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,25 @@ public partial class HamburgerMenu
5050
/// </summary>
5151
public static readonly DependencyProperty ItemTemplateProperty = DependencyProperty.Register(nameof(ItemTemplate), typeof(DataTemplate), typeof(HamburgerMenu), new PropertyMetadata(null));
5252

53-
public static readonly DependencyProperty ContentTransitionProperty = DependencyProperty.Register("ContentTransition", typeof(TransitionType), typeof(HamburgerMenu), new FrameworkPropertyMetadata(TransitionType.Normal));
53+
/// <summary>
54+
/// Identifies the <see cref="ItemTemplateSelector"/> dependency property.
55+
/// </summary>
56+
public static readonly DependencyProperty ItemTemplateSelectorProperty = DependencyProperty.Register(nameof(ItemTemplateSelector), typeof(DataTemplateSelector), typeof(HamburgerMenu), new PropertyMetadata(null));
57+
58+
/// <summary>
59+
/// Identifies the <see cref="SelectedItem"/> dependency property.
60+
/// </summary>
61+
public static readonly DependencyProperty SelectedItemProperty = DependencyProperty.Register(nameof(SelectedItem), typeof(object), typeof(HamburgerMenu), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));
62+
63+
/// <summary>
64+
/// Identifies the <see cref="SelectedIndex"/> dependency property.
65+
/// </summary>
66+
public static readonly DependencyProperty SelectedIndexProperty = DependencyProperty.Register(nameof(SelectedIndex), typeof(int), typeof(HamburgerMenu), new FrameworkPropertyMetadata(-1, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault | FrameworkPropertyMetadataOptions.Journal));
67+
68+
/// <summary>
69+
/// Identifies the <see cref="ContentTransition"/> dependency property.
70+
/// </summary>
71+
public static readonly DependencyProperty ContentTransitionProperty = DependencyProperty.Register(nameof(ContentTransition), typeof(TransitionType), typeof(HamburgerMenu), new FrameworkPropertyMetadata(TransitionType.Normal));
5472

5573
/// <summary>
5674
/// Gets or sets the width of the pane when it's fully expanded.
@@ -124,6 +142,15 @@ public DataTemplate ItemTemplate
124142
set { SetValue(ItemTemplateProperty, value); }
125143
}
126144

145+
/// <summary>
146+
/// Gets or sets the DataTemplateSelector used to display each item.
147+
/// </summary>
148+
public DataTemplateSelector ItemTemplateSelector
149+
{
150+
get { return (DataTemplateSelector)GetValue(ItemTemplateSelectorProperty); }
151+
set { SetValue(ItemTemplateSelectorProperty, value); }
152+
}
153+
127154
/// <summary>
128155
/// Gets the collection used to generate the content of the items list.
129156
/// </summary>
@@ -148,17 +175,17 @@ public ItemCollection Items
148175
/// </summary>
149176
public object SelectedItem
150177
{
151-
get { return _buttonsListView.SelectedItem; }
152-
set { _buttonsListView.SelectedItem = value; }
178+
get { return GetValue(SelectedItemProperty); }
179+
set { SetValue(SelectedItemProperty, value); }
153180
}
154181

155182
/// <summary>
156183
/// Gets or sets the selected menu index.
157184
/// </summary>
158185
public int SelectedIndex
159186
{
160-
get { return _buttonsListView.SelectedIndex; }
161-
set { _buttonsListView.SelectedIndex = value; }
187+
get { return (int)GetValue(SelectedIndexProperty); }
188+
set { SetValue(SelectedIndexProperty, value); }
162189
}
163190

164191
public TransitionType ContentTransition

src/MahApps.Metro/MahApps.Metro.Shared/Controls/HamburgerMenu/HamburgerMenu.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,15 @@ public override void OnApplyTemplate()
6262
_optionsListView.MouseUp += OptionsListView_ItemClick;
6363
}
6464

65+
this.Loaded -= HamburgerMenu_Loaded;
66+
this.Loaded += HamburgerMenu_Loaded;
67+
6568
base.OnApplyTemplate();
6669
}
70+
71+
private void HamburgerMenu_Loaded(object sender, RoutedEventArgs e)
72+
{
73+
this.Content = _buttonsListView?.SelectedItem ?? _optionsListView?.SelectedItem;
74+
}
6775
}
6876
}

src/MahApps.Metro/MahApps.Metro.Shared/Converters/StringToVisibilityConverter.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,13 @@ public override object ProvideValue(IServiceProvider serviceProvider)
5656

5757
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
5858
{
59-
if (value is string && targetType == typeof (Visibility))
59+
if ((value == null || value is string) && targetType == typeof (Visibility))
6060
{
6161
if (OppositeStringValue)
6262
{
63-
return (((string) value).ToLower().Equals(String.Empty)) ? Visibility.Visible : FalseEquivalent;
63+
return string.IsNullOrEmpty((string)value) ? Visibility.Visible : FalseEquivalent;
6464
}
65-
return (((string) value).ToLower().Equals(String.Empty)) ? FalseEquivalent : Visibility.Visible;
65+
return string.IsNullOrEmpty((string)value) ? FalseEquivalent : Visibility.Visible;
6666
}
6767
return value;
6868
}

src/MahApps.Metro/MahApps.Metro/Properties/AssemblyInfo.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
[assembly: AssemblyDescription("A toolkit for creating Metro / Modern UI styled WPF apps.")]
1616
[assembly: AssemblyCompany("MahApps")]
1717

18-
[assembly: AssemblyVersion("1.4.0.42")]
19-
[assembly: AssemblyFileVersion("1.4.0.42")]
20-
[assembly: AssemblyInformationalVersion("1.4.0.42")]
21-
[assembly: AssemblyProduct("MahApps.Metro 1.4.0")]
18+
[assembly: AssemblyVersion("1.4.1.0")]
19+
[assembly: AssemblyFileVersion("1.4.1.0")]
20+
[assembly: AssemblyInformationalVersion("1.4.1.0")]
21+
[assembly: AssemblyProduct("MahApps.Metro 1.4.1")]

src/MahApps.Metro/MahApps.Metro/Styles/Controls.DataGrid.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<Style.Triggers>
1818
<DataTrigger Binding="{Binding Path=IsReadOnly, RelativeSource={RelativeSource AncestorType=DataGridCell}}" Value="True">
1919
<Setter Property="IsHitTestVisible" Value="False" />
20+
<Setter Property="Focusable" Value="False" />
2021
</DataTrigger>
2122
</Style.Triggers>
2223
</Style>

0 commit comments

Comments
 (0)