From c65548411f23ea75c52ddbe4e67dc5ad416e1400 Mon Sep 17 00:00:00 2001 From: Nikola Metulev Date: Wed, 5 Jul 2017 14:31:06 -0700 Subject: [PATCH 01/15] changed MenuItem Header to type object --- Microsoft.Toolkit.Uwp.UI.Controls/Menu/MenuItem.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/Menu/MenuItem.cs b/Microsoft.Toolkit.Uwp.UI.Controls/Menu/MenuItem.cs index b9d91c40682..bbf5cb1b849 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls/Menu/MenuItem.cs +++ b/Microsoft.Toolkit.Uwp.UI.Controls/Menu/MenuItem.cs @@ -38,16 +38,16 @@ public class MenuItem : ItemsControl /// /// Identifies the dependency property. /// - public static readonly DependencyProperty HeaderProperty = DependencyProperty.Register(nameof(Header), typeof(string), typeof(MenuItem), new PropertyMetadata(default(string))); + public static readonly DependencyProperty HeaderProperty = DependencyProperty.Register(nameof(Header), typeof(object), typeof(MenuItem), new PropertyMetadata(null)); private Rect _bounds; /// /// Gets or sets the title to appear in the title bar /// - public string Header + public object Header { - get { return (string)GetValue(HeaderProperty); } + get { return (object)GetValue(HeaderProperty); } set { SetValue(HeaderProperty, value); } } From f6ec0f22b615f65eb42a2ccf9d11fcec81470b78 Mon Sep 17 00:00:00 2001 From: Hermit Dave Date: Tue, 11 Jul 2017 13:02:39 +0100 Subject: [PATCH 02/15] DropShadowPanel Content wireup size changed Wire up DropShadowPanel Content's size change to ensure that shadow is updated correctly. Address #1111 and #1299 --- .../DropShadowPanel/DropShadowPanel.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/DropShadowPanel/DropShadowPanel.cs b/Microsoft.Toolkit.Uwp.UI.Controls/DropShadowPanel/DropShadowPanel.cs index 744e42e6660..698cfc824a6 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls/DropShadowPanel/DropShadowPanel.cs +++ b/Microsoft.Toolkit.Uwp.UI.Controls/DropShadowPanel/DropShadowPanel.cs @@ -50,8 +50,6 @@ public DropShadowPanel() _dropShadow = compositor.CreateDropShadow(); _shadowVisual.Shadow = _dropShadow; - - SizeChanged += OnSizeChanged; } } @@ -72,6 +70,13 @@ protected override void OnApplyTemplate() ElementCompositionPreview.SetElementChildVisual(_border, _shadowVisual); } + var content = this.Content as FrameworkElement; + + if (content != null) + { + content.SizeChanged += OnSizeChanged; + } + ConfigureShadowVisualForCastingElement(); base.OnApplyTemplate(); From a4e0e16176f08acb4c72df6bf2f9b744b9d6e708 Mon Sep 17 00:00:00 2001 From: Hermit Dave Date: Wed, 12 Jul 2017 10:46:31 +0100 Subject: [PATCH 03/15] Override OnContentChanged for DropShadowPanel and wire unwire into content's size changed there. --- .../DropShadowPanel/DropShadowPanel.cs | 28 +++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/DropShadowPanel/DropShadowPanel.cs b/Microsoft.Toolkit.Uwp.UI.Controls/DropShadowPanel/DropShadowPanel.cs index 698cfc824a6..cef805c544e 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls/DropShadowPanel/DropShadowPanel.cs +++ b/Microsoft.Toolkit.Uwp.UI.Controls/DropShadowPanel/DropShadowPanel.cs @@ -70,16 +70,34 @@ protected override void OnApplyTemplate() ElementCompositionPreview.SetElementChildVisual(_border, _shadowVisual); } - var content = this.Content as FrameworkElement; + ConfigureShadowVisualForCastingElement(); + + base.OnApplyTemplate(); + } - if (content != null) + protected override void OnContentChanged(object oldContent, object newContent) + { + if (oldContent != null) { - content.SizeChanged += OnSizeChanged; + var oldElement = oldContent as FrameworkElement; + + if (oldElement != null) + { + oldElement.SizeChanged -= OnSizeChanged; + } } - ConfigureShadowVisualForCastingElement(); + if (newContent != null) + { + var newElement = newContent as FrameworkElement; - base.OnApplyTemplate(); + if (newElement != null) + { + newElement.SizeChanged += OnSizeChanged; + } + } + + base.OnContentChanged(oldContent, newContent); } private void OnSizeChanged(object sender, SizeChangedEventArgs e) From 724441fe195fc851db88b353b4d23fa4fba1d770 Mon Sep 17 00:00:00 2001 From: "DESKTOP-QJU4N0L\\mityh" Date: Wed, 12 Jul 2017 20:06:28 +1000 Subject: [PATCH 04/15] Adding headerTemplate --- .../SamplePages/Menu/MenuPage.xaml | 146 +----------------- .../Menu/Menu.xaml | 1 + .../Menu/MenuItem.cs | 17 +- 3 files changed, 24 insertions(+), 140 deletions(-) diff --git a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Menu/MenuPage.xaml b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Menu/MenuPage.xaml index 055bbafe6f9..1954ef16586 100644 --- a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Menu/MenuPage.xaml +++ b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Menu/MenuPage.xaml @@ -26,8 +26,14 @@ TooltipPlacement="{Binding TooltipPlacement.Value, Mode=TwoWay}"> + controls:Menu.InputGestureText="Alt+F"> + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/Menu/Menu.xaml b/Microsoft.Toolkit.Uwp.UI.Controls/Menu/Menu.xaml index 2e839fa10f1..93925357737 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls/Menu/Menu.xaml +++ b/Microsoft.Toolkit.Uwp.UI.Controls/Menu/Menu.xaml @@ -37,6 +37,7 @@ Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" Content="{TemplateBinding Header}" + ContentTemplate="{TemplateBinding HeaderTemplate}" Foreground="{TemplateBinding Foreground}" IsTabStop="False"> diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/Menu/MenuItem.cs b/Microsoft.Toolkit.Uwp.UI.Controls/Menu/MenuItem.cs index bbf5cb1b849..be4e82c97f1 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls/Menu/MenuItem.cs +++ b/Microsoft.Toolkit.Uwp.UI.Controls/Menu/MenuItem.cs @@ -32,6 +32,7 @@ public class MenuItem : ItemsControl private Menu _parentMenu; private bool _isOpened; private MenuFlyout _menuFlyout; + private Rect _bounds; internal Button FlyoutButton { get; private set; } @@ -40,8 +41,6 @@ public class MenuItem : ItemsControl /// public static readonly DependencyProperty HeaderProperty = DependencyProperty.Register(nameof(Header), typeof(object), typeof(MenuItem), new PropertyMetadata(null)); - private Rect _bounds; - /// /// Gets or sets the title to appear in the title bar /// @@ -51,6 +50,20 @@ public object Header set { SetValue(HeaderProperty, value); } } + /// + /// Identifies the dependency property. + /// + public static readonly DependencyProperty HeaderTemplateProperty = DependencyProperty.Register(nameof(HeaderTemplate), typeof(DataTemplate), typeof(MenuItem), new PropertyMetadata(null)); + + /// + /// Gets or sets the title to appear in the title bar + /// + public DataTemplate HeaderTemplate + { + get { return (DataTemplate)GetValue(HeaderTemplateProperty); } + set { SetValue(HeaderTemplateProperty, value); } + } + /// /// Gets a value indicating whether the menu is opened or not /// From 9432936483ca18f2fd44cadf035d21a1b1090cf9 Mon Sep 17 00:00:00 2001 From: "DESKTOP-QJU4N0L\\mityh" Date: Wed, 12 Jul 2017 20:08:45 +1000 Subject: [PATCH 05/15] Update bind file --- .../SamplePages/Menu/Menu.bind | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Menu/Menu.bind b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Menu/Menu.bind index f927cc0ba6a..9b894e747d5 100644 --- a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Menu/Menu.bind +++ b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Menu/Menu.bind @@ -27,8 +27,13 @@ Orientation="@[Orientation:Enum:Orientation.Horizontal]" TooltipPlacement="@[TooltipPlacement:Enum:PlacementMode.Bottom]"> - + + + + + + + Date: Wed, 12 Jul 2017 20:46:34 +1000 Subject: [PATCH 06/15] updating item documentation --- Microsoft.Toolkit.Uwp.UI.Controls/Menu/MenuItem.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/Menu/MenuItem.cs b/Microsoft.Toolkit.Uwp.UI.Controls/Menu/MenuItem.cs index be4e82c97f1..15b881d3cca 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls/Menu/MenuItem.cs +++ b/Microsoft.Toolkit.Uwp.UI.Controls/Menu/MenuItem.cs @@ -51,12 +51,12 @@ public object Header } /// - /// Identifies the dependency property. + /// Identifies the dependency property. /// public static readonly DependencyProperty HeaderTemplateProperty = DependencyProperty.Register(nameof(HeaderTemplate), typeof(DataTemplate), typeof(MenuItem), new PropertyMetadata(null)); /// - /// Gets or sets the title to appear in the title bar + /// Gets or sets the data template that is used to display the content of the MenuItem /// public DataTemplate HeaderTemplate { From a680e0be90dc95a6c4b05a649bf1e77fb49edf4a Mon Sep 17 00:00:00 2001 From: Un artisan du Code Date: Wed, 12 Jul 2017 17:00:02 +0200 Subject: [PATCH 07/15] TextBoxMasks in TextBoxMask The documentation is not in line with reality. --- docs/controls/TextBoxMask.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/controls/TextBoxMask.md b/docs/controls/TextBoxMask.md index 7a1b0d48198..3d92a6759c3 100644 --- a/docs/controls/TextBoxMask.md +++ b/docs/controls/TextBoxMask.md @@ -19,27 +19,27 @@ TextBoxMask has 2 type of characters 2) Fixed: which the user can't change and it is any non variable character ex the - in the first example Variable characters a represented to end user in form of placeholder so the user can know which characters he can change and which he can't, ex mask aaa-9999 will be presented to user as ___-____ -the default placeholder is _ but you can change it using controls:TextBoxMasks.PlaceHolder property (Check the second textbox in syntax section) +the default placeholder is _ but you can change it using controls:TextBoxMask.PlaceHolder property (Check the second textbox in syntax section) -In case you want to add a custom variable character you can use property TextBoxMasks.CustomMask (Check the third textbox in syntax section), you can add a character that represents certain regex as c:[a-c] and once you use character c in the mask the mask will prevent any characters but from a to c inside the TextBox, also you specify multiple variable characters by adding comma "," after every character and it's representation. this feature is helpful if you want to allow certain language characters ex French or Arabic only TextBox. +In case you want to add a custom variable character you can use property TextBoxMask.CustomMask (Check the third textbox in syntax section), you can add a character that represents certain regex as c:[a-c] and once you use character c in the mask the mask will prevent any characters but from a to c inside the TextBox, also you specify multiple variable characters by adding comma "," after every character and it's representation. this feature is helpful if you want to allow certain language characters ex French or Arabic only TextBox. ## Syntax ```xml - @@ -89,21 +89,21 @@ The following sample demonstrates how to add TextBoxMask property. - From 99ae9e63012fd3764406bb891f4dfe8a10c83e27 Mon Sep 17 00:00:00 2001 From: snrnats Date: Thu, 13 Jul 2017 00:18:22 +0300 Subject: [PATCH 08/15] Fixed type of a default value of HamburgerMenu.OpenPanelLength --- .../HamburgerMenu/HamburgerMenu.Properties.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/HamburgerMenu/HamburgerMenu.Properties.cs b/Microsoft.Toolkit.Uwp.UI.Controls/HamburgerMenu/HamburgerMenu.Properties.cs index bb5d2bb0e95..aa03762ae05 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls/HamburgerMenu/HamburgerMenu.Properties.cs +++ b/Microsoft.Toolkit.Uwp.UI.Controls/HamburgerMenu/HamburgerMenu.Properties.cs @@ -25,7 +25,7 @@ public partial class HamburgerMenu /// /// Identifies the dependency property. /// - public static readonly DependencyProperty OpenPaneLengthProperty = DependencyProperty.Register(nameof(OpenPaneLength), typeof(double), typeof(HamburgerMenu), new PropertyMetadata(320)); + public static readonly DependencyProperty OpenPaneLengthProperty = DependencyProperty.Register(nameof(OpenPaneLength), typeof(double), typeof(HamburgerMenu), new PropertyMetadata(320.0)); /// /// Identifies the dependency property. From 734fba0bbc0fd5a6f97171203fc983aa654f8fb0 Mon Sep 17 00:00:00 2001 From: Nikola Metulev Date: Fri, 14 Jul 2017 12:08:10 -0700 Subject: [PATCH 09/15] reverting back hamburgermenuitem --- .../HamburgerMenu/HamburgerMenuCode.bind | 57 ++++++++++++++--- .../HamburgerMenu/HamburgerMenuPage.xaml | 62 +++++++++++++++---- Microsoft.Toolkit.Uwp.SampleApp/Shell.xaml | 32 +++++++++- .../HamburgerMenu/HamburgerMenu.xaml | 48 -------------- .../MenuItems/HamburgerMenuGlyphItem.cs | 8 --- .../MenuItems/HamburgerMenuImageItem.cs | 8 --- .../MenuItems/HamburgerMenuItem.cs | 23 ++++++- 7 files changed, 149 insertions(+), 89 deletions(-) diff --git a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/HamburgerMenu/HamburgerMenuCode.bind b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/HamburgerMenu/HamburgerMenuCode.bind index d0befcd9489..ee8d1aa9672 100644 --- a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/HamburgerMenu/HamburgerMenuCode.bind +++ b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/HamburgerMenu/HamburgerMenuCode.bind @@ -8,9 +8,46 @@ xmlns:data="using:Microsoft.Toolkit.Uwp.SampleApp.Data" mc:Ignorable="d"> + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + + + + + diff --git a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/HamburgerMenu/HamburgerMenuPage.xaml b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/HamburgerMenu/HamburgerMenuPage.xaml index f58fa49ed82..8d7ea4aa207 100644 --- a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/HamburgerMenu/HamburgerMenuPage.xaml +++ b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/HamburgerMenu/HamburgerMenuPage.xaml @@ -5,12 +5,50 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"> + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + + + + + - @@ -58,7 +96,7 @@ + Source="{Binding Glyph}" /> diff --git a/Microsoft.Toolkit.Uwp.SampleApp/Shell.xaml b/Microsoft.Toolkit.Uwp.SampleApp/Shell.xaml index fc13104324e..7180b282d84 100644 --- a/Microsoft.Toolkit.Uwp.SampleApp/Shell.xaml +++ b/Microsoft.Toolkit.Uwp.SampleApp/Shell.xaml @@ -19,16 +19,44 @@ - + + + + + + + + - + + + + + + + + - - - -