Permalink
Browse files

Merge pull request #2798 from MahApps/develop

Merging content of 1.4.1 develop to master
  • Loading branch information...
2 parents 225d55a + 2353ecc commit 6c1dd3d8324b3d531760cec0c6d2cdc1c969a1e9 @punker76 punker76 committed on GitHub Jan 5, 2017
@@ -0,0 +1,15 @@
+# 1.4.1 Notes
+
+## Changes / Fixes
+
+- [#2793](https://github.com/MahApps/MahApps.Metro/pull/2793) StringToVisibilityConverter should handle null like an empty string
+- [#2796](https://github.com/MahApps/MahApps.Metro/pull/2796) HamburgerMenu SelectedIndex Fix
+- [#2797](https://github.com/MahApps/MahApps.Metro/pull/2797) Fix NumericUpDown using UseFloatingWatermark
+- [#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.
+
+## Closed Issues
+
+- [#2795](https://github.com/MahApps/MahApps.Metro/issues/2795) NumericUpDown Watermark is shown twice when using floatingwatermark for textboxes
+- [#2788](https://github.com/MahApps/MahApps.Metro/issues/2788) MetroDataGridCheckBox cell can be changed when IsReadOnly via keyboard + space
+- [#2785](https://github.com/MahApps/MahApps.Metro/issues/2785) Vailidation tooltips does not show.
+- [#2780](https://github.com/MahApps/MahApps.Metro/issues/2780) External Dialogs not visible with MainWindow set to IgnoreTaskbarOnMaximize
@@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/10/nuspec.xsd">
<metadata>
<id>MahApps.Metro</id>
- <version>1.4.0.0</version>
+ <version>1.4.1.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>
@@ -13,7 +13,7 @@
<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>
<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>
<releaseNotes />
- <tags>WPF UI Metro ModernUI Material XAML Toolkit Library .NET</tags>
+ <tags>WPF UI Metro Modern Material XAML Toolkit Library .NET</tags>
</metadata>
<files>
<file src="..\bin\MahApps.Metro\ReleaseNET40\MahApps.Metro.dll" target="lib\net40\MahApps.Metro.dll" />
@@ -51,6 +51,7 @@
<Grid>
<controls:HamburgerMenu x:Name="HamburgerMenuControl"
+ SelectedIndex="1"
Margin="20"
Foreground="White"
HamburgerWidth="48"
@@ -368,12 +368,15 @@ private void HandleMaximize()
var width = rect.Width;
var height = rect.Height;
- // Z-Order would only get refreshed/reflected if clicking the
- // the titlebar (as opposed to other parts of the external
- // window) unless I first set the window to HWND_BOTTOM then HWND_TOP before HWND_NOTOPMOST
- UnsafeNativeMethods.SetWindowPos(this.handle, Constants.HWND_BOTTOM, left, top, width, height, Constants.TOPMOST_FLAGS);
- UnsafeNativeMethods.SetWindowPos(this.handle, Constants.HWND_TOP, left, top, width, height, Constants.TOPMOST_FLAGS);
- UnsafeNativeMethods.SetWindowPos(this.handle, Constants.HWND_NOTOPMOST, left, top, width, height, Constants.TOPMOST_FLAGS);
+ // #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);
}
}
@@ -20,11 +20,26 @@ public partial class HamburgerMenu
public static readonly DependencyProperty OptionsItemTemplateProperty = DependencyProperty.Register(nameof(OptionsItemTemplate), typeof(DataTemplate), typeof(HamburgerMenu), new PropertyMetadata(null));
/// <summary>
+ /// Identifies the <see cref="OptionsItemTemplateSelector"/> dependency property.
+ /// </summary>
+ public static readonly DependencyProperty OptionsItemTemplateSelectorProperty = DependencyProperty.Register(nameof(OptionsItemTemplateSelector), typeof(DataTemplateSelector), typeof(HamburgerMenu), new PropertyMetadata(null));
+
+ /// <summary>
/// Identifies the <see cref="OptionsVisibility"/> dependency property.
/// </summary>
public static readonly DependencyProperty OptionsVisibilityProperty = DependencyProperty.Register(nameof(OptionsVisibility), typeof(Visibility), typeof(HamburgerMenu), new PropertyMetadata(Visibility.Visible));
/// <summary>
+ /// Identifies the <see cref="SelectedOptionsItem"/> dependency property.
+ /// </summary>
+ public static readonly DependencyProperty SelectedOptionsItemProperty = DependencyProperty.Register(nameof(SelectedOptionsItem), typeof(object), typeof(HamburgerMenu), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));
+
+ /// <summary>
+ /// Identifies the <see cref="SelectedOptionsIndex"/> dependency property.
+ /// </summary>
+ public static readonly DependencyProperty SelectedOptionsIndexProperty = DependencyProperty.Register(nameof(SelectedOptionsIndex), typeof(int), typeof(HamburgerMenu), new FrameworkPropertyMetadata(-1, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault | FrameworkPropertyMetadataOptions.Journal));
+
+ /// <summary>
/// Gets or sets an object source used to generate the content of the options.
/// </summary>
public object OptionsItemsSource
@@ -43,6 +58,15 @@ public DataTemplate OptionsItemTemplate
}
/// <summary>
+ /// Gets or sets the DataTemplateSelector used to display each item in the options.
+ /// </summary>
+ public DataTemplateSelector OptionsItemTemplateSelector
+ {
+ get { return (DataTemplateSelector)GetValue(OptionsItemTemplateSelectorProperty); }
+ set { SetValue(OptionsItemTemplateSelectorProperty, value); }
+ }
+
+ /// <summary>
/// Gets the collection used to generate the content of the option list.
/// </summary>
/// <exception cref="Exception">
@@ -75,17 +99,17 @@ public Visibility OptionsVisibility
/// </summary>
public object SelectedOptionsItem
{
- get { return _optionsListView.SelectedItem; }
- set { _optionsListView.SelectedItem = value; }
+ get { return GetValue(SelectedOptionsItemProperty); }
+ set { SetValue(SelectedOptionsItemProperty, value); }
}
/// <summary>
/// Gets or sets the selected options menu index.
/// </summary>
public int SelectedOptionsIndex
{
- get { return _optionsListView.SelectedIndex; }
- set { _optionsListView.SelectedIndex = value; }
+ get { return (int)GetValue(SelectedOptionsIndexProperty); }
+ set { SetValue(SelectedOptionsIndexProperty, value); }
}
}
}
@@ -50,7 +50,25 @@ public partial class HamburgerMenu
/// </summary>
public static readonly DependencyProperty ItemTemplateProperty = DependencyProperty.Register(nameof(ItemTemplate), typeof(DataTemplate), typeof(HamburgerMenu), new PropertyMetadata(null));
- public static readonly DependencyProperty ContentTransitionProperty = DependencyProperty.Register("ContentTransition", typeof(TransitionType), typeof(HamburgerMenu), new FrameworkPropertyMetadata(TransitionType.Normal));
+ /// <summary>
+ /// Identifies the <see cref="ItemTemplateSelector"/> dependency property.
+ /// </summary>
+ public static readonly DependencyProperty ItemTemplateSelectorProperty = DependencyProperty.Register(nameof(ItemTemplateSelector), typeof(DataTemplateSelector), typeof(HamburgerMenu), new PropertyMetadata(null));
+
+ /// <summary>
+ /// Identifies the <see cref="SelectedItem"/> dependency property.
+ /// </summary>
+ public static readonly DependencyProperty SelectedItemProperty = DependencyProperty.Register(nameof(SelectedItem), typeof(object), typeof(HamburgerMenu), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));
+
+ /// <summary>
+ /// Identifies the <see cref="SelectedIndex"/> dependency property.
+ /// </summary>
+ public static readonly DependencyProperty SelectedIndexProperty = DependencyProperty.Register(nameof(SelectedIndex), typeof(int), typeof(HamburgerMenu), new FrameworkPropertyMetadata(-1, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault | FrameworkPropertyMetadataOptions.Journal));
+
+ /// <summary>
+ /// Identifies the <see cref="ContentTransition"/> dependency property.
+ /// </summary>
+ public static readonly DependencyProperty ContentTransitionProperty = DependencyProperty.Register(nameof(ContentTransition), typeof(TransitionType), typeof(HamburgerMenu), new FrameworkPropertyMetadata(TransitionType.Normal));
/// <summary>
/// Gets or sets the width of the pane when it's fully expanded.
@@ -125,6 +143,15 @@ public DataTemplate ItemTemplate
}
/// <summary>
+ /// Gets or sets the DataTemplateSelector used to display each item.
+ /// </summary>
+ public DataTemplateSelector ItemTemplateSelector
+ {
+ get { return (DataTemplateSelector)GetValue(ItemTemplateSelectorProperty); }
+ set { SetValue(ItemTemplateSelectorProperty, value); }
+ }
+
+ /// <summary>
/// Gets the collection used to generate the content of the items list.
/// </summary>
/// <exception cref="Exception">
@@ -148,17 +175,17 @@ public ItemCollection Items
/// </summary>
public object SelectedItem
{
- get { return _buttonsListView.SelectedItem; }
- set { _buttonsListView.SelectedItem = value; }
+ get { return GetValue(SelectedItemProperty); }
+ set { SetValue(SelectedItemProperty, value); }
}
/// <summary>
/// Gets or sets the selected menu index.
/// </summary>
public int SelectedIndex
{
- get { return _buttonsListView.SelectedIndex; }
- set { _buttonsListView.SelectedIndex = value; }
+ get { return (int)GetValue(SelectedIndexProperty); }
+ set { SetValue(SelectedIndexProperty, value); }
}
public TransitionType ContentTransition
@@ -62,7 +62,15 @@ public override void OnApplyTemplate()
_optionsListView.MouseUp += OptionsListView_ItemClick;
}
+ this.Loaded -= HamburgerMenu_Loaded;
+ this.Loaded += HamburgerMenu_Loaded;
+
base.OnApplyTemplate();
}
+
+ private void HamburgerMenu_Loaded(object sender, RoutedEventArgs e)
+ {
+ this.Content = _buttonsListView?.SelectedItem ?? _optionsListView?.SelectedItem;
+ }
}
}
@@ -56,13 +56,13 @@ public override object ProvideValue(IServiceProvider serviceProvider)
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
- if (value is string && targetType == typeof (Visibility))
+ if ((value == null || value is string) && targetType == typeof (Visibility))
{
if (OppositeStringValue)
{
- return (((string) value).ToLower().Equals(String.Empty)) ? Visibility.Visible : FalseEquivalent;
+ return string.IsNullOrEmpty((string)value) ? Visibility.Visible : FalseEquivalent;
}
- return (((string) value).ToLower().Equals(String.Empty)) ? FalseEquivalent : Visibility.Visible;
+ return string.IsNullOrEmpty((string)value) ? FalseEquivalent : Visibility.Visible;
}
return value;
}
@@ -15,7 +15,7 @@
[assembly: AssemblyDescription("A toolkit for creating Metro / Modern UI styled WPF apps.")]
[assembly: AssemblyCompany("MahApps")]
-[assembly: AssemblyVersion("1.4.0.42")]
-[assembly: AssemblyFileVersion("1.4.0.42")]
-[assembly: AssemblyInformationalVersion("1.4.0.42")]
-[assembly: AssemblyProduct("MahApps.Metro 1.4.0")]
+[assembly: AssemblyVersion("1.4.1.0")]
+[assembly: AssemblyFileVersion("1.4.1.0")]
+[assembly: AssemblyInformationalVersion("1.4.1.0")]
+[assembly: AssemblyProduct("MahApps.Metro 1.4.1")]
@@ -17,6 +17,7 @@
<Style.Triggers>
<DataTrigger Binding="{Binding Path=IsReadOnly, RelativeSource={RelativeSource AncestorType=DataGridCell}}" Value="True">
<Setter Property="IsHitTestVisible" Value="False" />
+ <Setter Property="Focusable" Value="False" />
</DataTrigger>
</Style.Triggers>
</Style>
@@ -5,15 +5,18 @@
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/VS/Colors.xaml" />
</ResourceDictionary.MergedDictionaries>
- <Style x:Key="StandardTextBox" TargetType="TextBox">
+ <Style x:Key="StandardTextBox" TargetType="{x:Type TextBox}">
<Setter Property="Background" Value="{StaticResource TextBoxBackground}" />
<Setter Property="CaretBrush" Value="{StaticResource Foreground}" />
<Setter Property="Foreground" Value="{StaticResource Foreground}" />
+ <Setter Property="Padding" Value="1" />
+ <Setter Property="SnapsToDevicePixels" Value="True" />
+ <Setter Property="Validation.ErrorTemplate" Value="{DynamicResource ValidationErrorTemplate}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TextBox}">
- <Grid Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
- <ScrollViewer x:Name="PART_ContentHost" Margin="1" />
+ <Grid Background="{TemplateBinding Background}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
+ <ScrollViewer x:Name="PART_ContentHost" Margin="{TemplateBinding Padding}" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
@@ -28,21 +31,20 @@
</Setter>
</Style>
- <Style x:Key="SearchTextBox" TargetType="TextBox">
- <Setter Property="Background" Value="{StaticResource TextBoxBackground}" />
- <Setter Property="CaretBrush" Value="{StaticResource Foreground}" />
- <Setter Property="Foreground" Value="{StaticResource Foreground}" />
+ <Style x:Key="SearchTextBox"
+ TargetType="{x:Type TextBox}"
+ BasedOn="{StaticResource StandardTextBox}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TextBox}">
- <Grid Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
+ <Grid Background="{TemplateBinding Background}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
<TextBlock Name="search"
Margin="5 0 0 0"
VerticalAlignment="Center"
Foreground="{StaticResource SearchTextForeground}"
Text="Search ..."
Visibility="Hidden" />
- <ScrollViewer x:Name="PART_ContentHost" Margin="1" />
+ <ScrollViewer x:Name="PART_ContentHost" Margin="{TemplateBinding Padding}" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="TextBox.Text" Value="">
@@ -103,11 +103,15 @@
Grid.Row="1"
Width="{TemplateBinding OpenPaneLength}"
AutomationProperties.Name="Menu items"
+ ItemTemplateSelector="{TemplateBinding ItemTemplateSelector}"
ItemTemplate="{TemplateBinding ItemTemplate}"
ItemsSource="{TemplateBinding ItemsSource}"
+ SelectedIndex="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedIndex, Mode=TwoWay}"
+ SelectedItem="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedItem, Mode=TwoWay}"
SelectionMode="Single"
Style="{StaticResource HamburgerListBoxStyle}"
- TabIndex="1" />
+ TabIndex="1">
+ </ListBox>
<Grid Grid.Row="2" Visibility="{TemplateBinding OptionsVisibility}">
<Grid.RowDefinitions>
@@ -120,8 +124,11 @@
Width="{TemplateBinding OpenPaneLength}"
VerticalAlignment="Bottom"
AutomationProperties.Name="Option items"
+ ItemTemplateSelector="{TemplateBinding OptionsItemTemplateSelector}"
ItemTemplate="{TemplateBinding OptionsItemTemplate}"
ItemsSource="{TemplateBinding OptionsItemsSource}"
+ SelectedIndex="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedOptionsIndex, Mode=TwoWay}"
+ SelectedItem="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedOptionsItem, Mode=TwoWay}"
Style="{StaticResource HamburgerListBoxStyle}"
TabIndex="2" />
</Grid>
Oops, something went wrong.

0 comments on commit 6c1dd3d

Please sign in to comment.