From 3ae418a10d89429579a61d5da9b7ee713544c8c1 Mon Sep 17 00:00:00 2001 From: "PandaSharp (Emiliano84)" <7117301+Panda-Sharp@users.noreply.github.com> Date: Wed, 14 Apr 2021 14:24:17 +0200 Subject: [PATCH 01/18] Update Mouse to FrameworkElementExtensions This will fix the oversight in the documentation after the 7.0 breaking change --- .../SamplePages/Mouse/MouseCursorPage.bind | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Mouse/MouseCursorPage.bind b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Mouse/MouseCursorPage.bind index 55fa0cd73..59482b55d 100644 --- a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Mouse/MouseCursorPage.bind +++ b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Mouse/MouseCursorPage.bind @@ -8,7 +8,7 @@ Margin="50,100,20,20" HorizontalAlignment="Left" VerticalAlignment="Top" - ui:Mouse.Cursor="UniversalNo" + ui:FrameworkElementExtensions.Cursor="UniversalNo" Background="DeepSkyBlue"> - \ No newline at end of file + From 9481e9c90f1485ed20a27d0ee1e8f7c15598c582 Mon Sep 17 00:00:00 2001 From: Alexandre Zollinger Chohfi Date: Thu, 15 Apr 2021 17:31:56 -0700 Subject: [PATCH 02/18] Turned off layout rounding for failing tests --- .../UnitTests.UWP/UI/Controls/Test_WrapPanel_Visibility.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/UnitTests/UnitTests.UWP/UI/Controls/Test_WrapPanel_Visibility.cs b/UnitTests/UnitTests.UWP/UI/Controls/Test_WrapPanel_Visibility.cs index 9ed9f0eeb..50cd685d5 100644 --- a/UnitTests/UnitTests.UWP/UI/Controls/Test_WrapPanel_Visibility.cs +++ b/UnitTests/UnitTests.UWP/UI/Controls/Test_WrapPanel_Visibility.cs @@ -37,6 +37,8 @@ namespace UnitTests.UI.Controls ") as FrameworkElement; + treeRoot.UseLayoutRounding = false; + var expected = new (int u, int v, int w, int h)[] { (0, 0, 0, 0), // Collapsed @@ -94,6 +96,8 @@ namespace UnitTests.UI.Controls ") as FrameworkElement; + treeRoot.UseLayoutRounding = false; + var expected = new (int u, int v, int w, int h)[] { (0, 0, 150, 50), @@ -149,6 +153,8 @@ namespace UnitTests.UI.Controls ") as FrameworkElement; + treeRoot.UseLayoutRounding = false; + var expected = new (int u, int v, int w, int h)[] { (0, 0, 150, 50), From 4556c8a5f4290eb7aa89ccab95cc5b4e12baca80 Mon Sep 17 00:00:00 2001 From: "PandaSharp (Emiliano84)" <7117301+Panda-Sharp@users.noreply.github.com> Date: Fri, 16 Apr 2021 09:24:21 +0200 Subject: [PATCH 03/18] Update MouseCursorPage.bind --- .../SamplePages/Mouse/MouseCursorPage.bind | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Mouse/MouseCursorPage.bind b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Mouse/MouseCursorPage.bind index 59482b55d..19986455f 100644 --- a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Mouse/MouseCursorPage.bind +++ b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Mouse/MouseCursorPage.bind @@ -21,7 +21,7 @@ Margin="20" HorizontalAlignment="Left" VerticalAlignment="Top" - ui:Mouse.Cursor="Wait" + ui:FrameworkElementExtensions.Cursor="Wait" Background="Orange"> From fe7a98b6368fa0da56870aee4dfe4574cc31a17e Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Fri, 9 Apr 2021 19:02:40 +0200 Subject: [PATCH 04/18] Enabled correct WeakReferenceMessenger path on .NET 5 --- .../Messaging/WeakReferenceMessenger.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Microsoft.Toolkit.Mvvm/Messaging/WeakReferenceMessenger.cs b/Microsoft.Toolkit.Mvvm/Messaging/WeakReferenceMessenger.cs index 37e391636..72357897a 100644 --- a/Microsoft.Toolkit.Mvvm/Messaging/WeakReferenceMessenger.cs +++ b/Microsoft.Toolkit.Mvvm/Messaging/WeakReferenceMessenger.cs @@ -9,10 +9,10 @@ using System.Diagnostics.Contracts; using System.Runtime.CompilerServices; using Microsoft.Collections.Extensions; using Microsoft.Toolkit.Mvvm.Messaging.Internals; -#if NETSTANDARD2_1 -using RecipientsTable = System.Runtime.CompilerServices.ConditionalWeakTable; -#else +#if NETSTANDARD2_0 using RecipientsTable = Microsoft.Toolkit.Mvvm.Messaging.WeakReferenceMessenger.ConditionalWeakTable; +#else +using RecipientsTable = System.Runtime.CompilerServices.ConditionalWeakTable; #endif namespace Microsoft.Toolkit.Mvvm.Messaging @@ -288,7 +288,7 @@ namespace Microsoft.Toolkit.Mvvm.Messaging } } -#if !NETSTANDARD2_1 +#if NETSTANDARD2_0 /// /// A wrapper for /// that backports the enumerable support to .NET Standard 2.0 through an auxiliary list. @@ -470,7 +470,7 @@ namespace Microsoft.Toolkit.Mvvm.Messaging [MethodImpl(MethodImplOptions.AggressiveInlining)] public static ArrayPoolBufferWriter Create() { - return new ArrayPoolBufferWriter { array = ArrayPool.Shared.Rent(DefaultInitialBufferSize) }; + return new() { array = ArrayPool.Shared.Rent(DefaultInitialBufferSize) }; } /// From de46427a78848d408e89c12374f5c2a4264f731e Mon Sep 17 00:00:00 2001 From: Salman Muin Kayser Chishti <13schishti@Gmail.com> Date: Wed, 30 Oct 2019 04:08:39 +0000 Subject: [PATCH 05/18] Update PropertyKind.cs --- .../Models/PropertyDescriptor/PropertyKind.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Microsoft.Toolkit.Uwp.SampleApp/Models/PropertyDescriptor/PropertyKind.cs b/Microsoft.Toolkit.Uwp.SampleApp/Models/PropertyDescriptor/PropertyKind.cs index a4cb96329..1a5c1679c 100644 --- a/Microsoft.Toolkit.Uwp.SampleApp/Models/PropertyDescriptor/PropertyKind.cs +++ b/Microsoft.Toolkit.Uwp.SampleApp/Models/PropertyDescriptor/PropertyKind.cs @@ -13,6 +13,6 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.Models Bool, Brush, TimeSpan, - Thickness + Thicknessasdfadsf } } From 74de9e30c8de9ec7c07cd599e95b178e892269f6 Mon Sep 17 00:00:00 2001 From: SalmanMKC <13schishti@gmail.com> Date: Wed, 1 Apr 2020 01:57:58 +0100 Subject: [PATCH 06/18] undo change --- .../Models/PropertyDescriptor/PropertyKind.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Microsoft.Toolkit.Uwp.SampleApp/Models/PropertyDescriptor/PropertyKind.cs b/Microsoft.Toolkit.Uwp.SampleApp/Models/PropertyDescriptor/PropertyKind.cs index 1a5c1679c..a4cb96329 100644 --- a/Microsoft.Toolkit.Uwp.SampleApp/Models/PropertyDescriptor/PropertyKind.cs +++ b/Microsoft.Toolkit.Uwp.SampleApp/Models/PropertyDescriptor/PropertyKind.cs @@ -13,6 +13,6 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.Models Bool, Brush, TimeSpan, - Thicknessasdfadsf + Thickness } } From 89d3c6a173821712df955a50d22adca1796ee12d Mon Sep 17 00:00:00 2001 From: SalmanMKC <13schishti@gmail.com> Date: Wed, 1 Apr 2020 16:50:51 +0100 Subject: [PATCH 07/18] Functionality done --- .../InfiniteCanvas/InfiniteCanvas.TextBox.cs | 6 ++-- .../InfiniteCanvas/InfiniteCanvas.cs | 8 ++--- .../InfiniteCanvas/InfiniteCanvas.xaml | 36 +++++++++++++++---- 3 files changed, 36 insertions(+), 14 deletions(-) diff --git a/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.TextBox.cs b/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.TextBox.cs index 6edfd098f..360168bfd 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.TextBox.cs +++ b/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.TextBox.cs @@ -41,10 +41,10 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls { get { - if (!string.IsNullOrWhiteSpace(_canvasTextBoxFontSizeTextBox.Text) && + if (!string.IsNullOrWhiteSpace(_canvasTextBoxFontSizeTextBox.SelectedValue.ToString()) && Regex.IsMatch(_canvasTextBoxFontSizeTextBox.Text, "^[0-9]*$")) { - var fontSize = int.Parse(_canvasTextBoxFontSizeTextBox.Text); + var fontSize = int.Parse((_canvasTextBoxFontSizeTextBox.SelectedItem as ComboBoxItem).Content.ToString()); _lastValidTextFontSizeValue = fontSize; } @@ -93,7 +93,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls } } - private void CanvasTextBoxFontSizeTextBox_TextChanged(object sender, TextChangedEventArgs e) + private void CanvasTextBoxFontSizeTextBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { _canvasTextBox.UpdateFontSize(TextFontSize); if (SelectedTextDrawable != null) diff --git a/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.cs b/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.cs index be4e955b2..c2e3904fd 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.cs +++ b/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.cs @@ -71,7 +71,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls private StackPanel _canvasTextBoxTools; private Windows.UI.Xaml.Controls.ColorPicker _canvasTextBoxColorPicker; - private TextBox _canvasTextBoxFontSizeTextBox; + private ComboBox _canvasTextBoxFontSizeTextBox; private ToggleButton _canvasTextBoxItalicButton; private ToggleButton _canvasTextBoxBoldButton; private Button _undoButton; @@ -244,7 +244,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls { _canvasTextBoxTools = (StackPanel)GetTemplateChild(CanvasTextBoxToolsName); this._canvasTextBoxColorPicker = (Windows.UI.Xaml.Controls.ColorPicker)GetTemplateChild(CanvasTextBoxColorPickerName); - _canvasTextBoxFontSizeTextBox = (TextBox)GetTemplateChild(CanvasTextBoxFontSizeTextBoxName); + _canvasTextBoxFontSizeTextBox = (ComboBox)GetTemplateChild(CanvasTextBoxFontSizeTextBoxName); _canvasTextBoxItalicButton = (ToggleButton)GetTemplateChild(CanvasTextBoxItalicButtonName); _canvasTextBoxBoldButton = (ToggleButton)GetTemplateChild(CanvasTextBoxBoldButtonName); _drawingSurfaceRenderer = (InfiniteCanvasVirtualDrawingSurface)GetTemplateChild(DrawingSurfaceRendererName); @@ -296,7 +296,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls private void UnRegisterEvents() { - _canvasTextBoxFontSizeTextBox.TextChanged -= CanvasTextBoxFontSizeTextBox_TextChanged; + _canvasTextBoxFontSizeTextBox.SelectionChanged -= CanvasTextBoxFontSizeTextBox_SelectionChanged; _canvasTextBoxItalicButton.Click -= CanvasTextBoxItalicButton_Clicked; _canvasTextBoxBoldButton.Click -= CanvasTextBoxBoldButton_Clicked; _canvasTextBoxColorPicker.ColorChanged -= CanvasTextBoxColorPicker_ColorChanged; @@ -320,7 +320,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls private void RegisterEvents() { - _canvasTextBoxFontSizeTextBox.TextChanged += CanvasTextBoxFontSizeTextBox_TextChanged; + _canvasTextBoxFontSizeTextBox.SelectionChanged += CanvasTextBoxFontSizeTextBox_SelectionChanged; _canvasTextBoxItalicButton.Click += CanvasTextBoxItalicButton_Clicked; _canvasTextBoxBoldButton.Click += CanvasTextBoxBoldButton_Clicked; _canvasTextBoxColorPicker.ColorChanged += CanvasTextBoxColorPicker_ColorChanged; diff --git a/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.xaml b/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.xaml index 975ef8577..e0c546f8c 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.xaml +++ b/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.xaml @@ -97,13 +97,35 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + From 79661ed4d0584906edab5089387bc45be0a16f25 Mon Sep 17 00:00:00 2001 From: SalmanMKC <13schishti@gmail.com> Date: Wed, 1 Apr 2020 16:58:50 +0100 Subject: [PATCH 08/18] capitalisation corrections --- .../InfiniteCanvas/InfiniteCanvas.TextBox.cs | 12 ++++++------ .../InfiniteCanvas/InfiniteCanvas.cs | 16 ++++++++-------- .../InfiniteCanvas/InfiniteCanvas.xaml | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.TextBox.cs b/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.TextBox.cs index 360168bfd..9b1d5ff3a 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.TextBox.cs +++ b/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.TextBox.cs @@ -41,10 +41,10 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls { get { - if (!string.IsNullOrWhiteSpace(_canvasTextBoxFontSizeTextBox.SelectedValue.ToString()) && - Regex.IsMatch(_canvasTextBoxFontSizeTextBox.Text, "^[0-9]*$")) + if (!string.IsNullOrWhiteSpace(_canvasComboBoxFontSizeTextBox.SelectedValue.ToString()) && + Regex.IsMatch(_canvasComboBoxFontSizeTextBox.Text, "^[0-9]*$")) { - var fontSize = int.Parse((_canvasTextBoxFontSizeTextBox.SelectedItem as ComboBoxItem).Content.ToString()); + var fontSize = int.Parse((_canvasComboBoxFontSizeTextBox.SelectedItem as ComboBoxItem).Content.ToString()); _lastValidTextFontSizeValue = fontSize; } @@ -93,7 +93,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls } } - private void CanvasTextBoxFontSizeTextBox_SelectionChanged(object sender, SelectionChangedEventArgs e) + private void CanvasComboBoxFontSizeTextBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { _canvasTextBox.UpdateFontSize(TextFontSize); if (SelectedTextDrawable != null) @@ -185,7 +185,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls // Updating toolbar _canvasTextBoxColorPicker.Color = SelectedTextDrawable.TextColor; - _canvasTextBoxFontSizeTextBox.Text = SelectedTextDrawable.FontSize.ToString(); + _canvasComboBoxFontSizeTextBox.Text = SelectedTextDrawable.FontSize.ToString(); _canvasTextBoxBoldButton.IsChecked = SelectedTextDrawable.IsBold; _canvasTextBoxItalicButton.IsChecked = SelectedTextDrawable.IsItalic; @@ -210,7 +210,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls _canvasTextBox.Clear(); } - private void CanvasTextBoxFontSizeTextBox_PreviewKeyDown(object sender, KeyRoutedEventArgs e) + private void CanvasComboBoxFontSizeTextBox_PreviewKeyDown(object sender, KeyRoutedEventArgs e) { if (_allowedCommands.Contains(e.Key.ToString())) { diff --git a/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.cs b/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.cs index c2e3904fd..abdd3c099 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.cs +++ b/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.cs @@ -21,7 +21,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls /// [TemplatePart(Name = CanvasTextBoxToolsName, Type = typeof(StackPanel))] [TemplatePart(Name = CanvasTextBoxColorPickerName, Type = typeof(Windows.UI.Xaml.Controls.ColorPicker))] - [TemplatePart(Name = CanvasTextBoxFontSizeTextBoxName, Type = typeof(TextBox))] + [TemplatePart(Name = CanvasComboBoxFontSizeTextBoxName, Type = typeof(TextBox))] [TemplatePart(Name = CanvasTextBoxItalicButtonName, Type = typeof(ToggleButton))] [TemplatePart(Name = CanvasTextBoxBoldButtonName, Type = typeof(ToggleButton))] [TemplatePart(Name = DrawingSurfaceRendererName, Type = typeof(InfiniteCanvasVirtualDrawingSurface))] @@ -45,7 +45,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls private const string CanvasTextBoxToolsName = "CanvasTextBoxTools"; private const string CanvasTextBoxColorPickerName = "CanvasTextBoxColorPicker"; - private const string CanvasTextBoxFontSizeTextBoxName = "CanvasTextBoxFontSizeTextBox"; + private const string CanvasComboBoxFontSizeTextBoxName = "CanvasComboBoxFontSizeTextBox"; private const string CanvasTextBoxItalicButtonName = "CanvasTextBoxItalicButton"; private const string CanvasTextBoxBoldButtonName = "CanvasTextBoxBoldButton"; private const string DrawingSurfaceRendererName = "DrawingSurfaceRenderer"; @@ -71,7 +71,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls private StackPanel _canvasTextBoxTools; private Windows.UI.Xaml.Controls.ColorPicker _canvasTextBoxColorPicker; - private ComboBox _canvasTextBoxFontSizeTextBox; + private ComboBox _canvasComboBoxFontSizeTextBox; private ToggleButton _canvasTextBoxItalicButton; private ToggleButton _canvasTextBoxBoldButton; private Button _undoButton; @@ -244,7 +244,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls { _canvasTextBoxTools = (StackPanel)GetTemplateChild(CanvasTextBoxToolsName); this._canvasTextBoxColorPicker = (Windows.UI.Xaml.Controls.ColorPicker)GetTemplateChild(CanvasTextBoxColorPickerName); - _canvasTextBoxFontSizeTextBox = (ComboBox)GetTemplateChild(CanvasTextBoxFontSizeTextBoxName); + _canvasComboBoxFontSizeTextBox = (ComboBox)GetTemplateChild(CanvasComboBoxFontSizeTextBoxName); _canvasTextBoxItalicButton = (ToggleButton)GetTemplateChild(CanvasTextBoxItalicButtonName); _canvasTextBoxBoldButton = (ToggleButton)GetTemplateChild(CanvasTextBoxBoldButtonName); _drawingSurfaceRenderer = (InfiniteCanvasVirtualDrawingSurface)GetTemplateChild(DrawingSurfaceRendererName); @@ -296,7 +296,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls private void UnRegisterEvents() { - _canvasTextBoxFontSizeTextBox.SelectionChanged -= CanvasTextBoxFontSizeTextBox_SelectionChanged; + _canvasComboBoxFontSizeTextBox.SelectionChanged -= CanvasComboBoxFontSizeTextBox_SelectionChanged; _canvasTextBoxItalicButton.Click -= CanvasTextBoxItalicButton_Clicked; _canvasTextBoxBoldButton.Click -= CanvasTextBoxBoldButton_Clicked; _canvasTextBoxColorPicker.ColorChanged -= CanvasTextBoxColorPicker_ColorChanged; @@ -314,13 +314,13 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls Unloaded -= InfiniteCanvas_Unloaded; Application.Current.LeavingBackground -= Current_LeavingBackground; _drawingSurfaceRenderer.CommandExecuted -= DrawingSurfaceRenderer_CommandExecuted; - _canvasTextBoxFontSizeTextBox.PreviewKeyDown -= CanvasTextBoxFontSizeTextBox_PreviewKeyDown; + _canvasComboBoxFontSizeTextBox.PreviewKeyDown -= CanvasComboBoxFontSizeTextBox_PreviewKeyDown; Loaded -= InfiniteCanvas_Loaded; } private void RegisterEvents() { - _canvasTextBoxFontSizeTextBox.SelectionChanged += CanvasTextBoxFontSizeTextBox_SelectionChanged; + _canvasComboBoxFontSizeTextBox.SelectionChanged += CanvasComboBoxFontSizeTextBox_SelectionChanged; _canvasTextBoxItalicButton.Click += CanvasTextBoxItalicButton_Clicked; _canvasTextBoxBoldButton.Click += CanvasTextBoxBoldButton_Clicked; _canvasTextBoxColorPicker.ColorChanged += CanvasTextBoxColorPicker_ColorChanged; @@ -338,7 +338,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls Unloaded += InfiniteCanvas_Unloaded; Application.Current.LeavingBackground += Current_LeavingBackground; _drawingSurfaceRenderer.CommandExecuted += DrawingSurfaceRenderer_CommandExecuted; - _canvasTextBoxFontSizeTextBox.PreviewKeyDown += CanvasTextBoxFontSizeTextBox_PreviewKeyDown; + _canvasComboBoxFontSizeTextBox.PreviewKeyDown += CanvasComboBoxFontSizeTextBox_PreviewKeyDown; Loaded += InfiniteCanvas_Loaded; } diff --git a/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.xaml b/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.xaml index e0c546f8c..4d1a869ef 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.xaml +++ b/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.xaml @@ -97,7 +97,7 @@ - From 8546875cd20f972fb035d9e3b4df8f1c699655bb Mon Sep 17 00:00:00 2001 From: Salman Muin Kayser Chishti <13schishti@gmail.com> Date: Thu, 9 Apr 2020 00:26:00 +0100 Subject: [PATCH 09/18] removed duplicate 48 size font --- .../InfiniteCanvas/InfiniteCanvas.xaml | 1 - 1 file changed, 1 deletion(-) diff --git a/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.xaml b/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.xaml index 4d1a869ef..52bc99e4a 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.xaml +++ b/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.xaml @@ -117,7 +117,6 @@ - From 40028a7183dc5ce1140492642808b7602b9e2c6d Mon Sep 17 00:00:00 2001 From: Salman Muin Kayser Chishti <13schishti@gmail.com> Date: Fri, 11 Sep 2020 13:44:14 +0100 Subject: [PATCH 10/18] Update Microsoft.Toolkit.Uwp.UI.Controls/InfiniteCanvas/InfiniteCanvas.xaml Co-authored-by: Michael Hawker MSFT (XAML Llama) <24302614+michael-hawker@users.noreply.github.com> --- .../InfiniteCanvas/InfiniteCanvas.xaml | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.xaml b/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.xaml index 52bc99e4a..c74385f62 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.xaml +++ b/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.xaml @@ -103,27 +103,19 @@ - + + - - - - - - - - - From 6218a967de0de9e4089b5a8e0c152a5ccbc5c4f2 Mon Sep 17 00:00:00 2001 From: Rosario Pulella Date: Fri, 2 Apr 2021 14:52:02 -0400 Subject: [PATCH 11/18] CanvasComboBoxFontSizeTextBox add back in tooltip --- .../InfiniteCanvas/InfiniteCanvas.xaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.xaml b/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.xaml index c74385f62..8e4ecad8b 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.xaml +++ b/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.xaml @@ -99,7 +99,12 @@ + Height="32" + SelectedIndex="9" + Margin="0,0,12,0" + VerticalAlignment="Center" + ToolTipService.ToolTip="Font Size" + > From f9837b5304808b27ebb5bcec917e5861a0e76025 Mon Sep 17 00:00:00 2001 From: Rosario Pulella Date: Fri, 2 Apr 2021 15:46:34 -0400 Subject: [PATCH 12/18] WIP: make combobox editable --- .../InfiniteCanvas/InfiniteCanvas.xaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.xaml b/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.xaml index 8e4ecad8b..8530bff3b 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.xaml +++ b/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.xaml @@ -104,6 +104,7 @@ Margin="0,0,12,0" VerticalAlignment="Center" ToolTipService.ToolTip="Font Size" + IsEditable="True" > From 5b2434f38f5ba9b7dd4c60e66e06991664eef1d8 Mon Sep 17 00:00:00 2001 From: Rosario Pulella Date: Fri, 9 Apr 2021 13:30:11 -0400 Subject: [PATCH 13/18] Font size align type with underlying win2d CanvasTestFormat int -> float Note: Control.FontSize is a double, perhaps win2d should allign with this and this should be changed to doulbe then. --- .../Commands/InfiniteCanvasCreateTextBoxCommand.cs | 2 +- .../InfiniteCanvasVirtualDrawingSurface.Commands.cs | 2 +- .../InfiniteCanvas/InfiniteCanvas.TextBox.cs | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/Commands/InfiniteCanvasCreateTextBoxCommand.cs b/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/Commands/InfiniteCanvasCreateTextBoxCommand.cs index cfd5d2862..85db685d8 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/Commands/InfiniteCanvasCreateTextBoxCommand.cs +++ b/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/Commands/InfiniteCanvasCreateTextBoxCommand.cs @@ -12,7 +12,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls private readonly List _drawableList; private readonly TextDrawable _drawable; - public InfiniteCanvasCreateTextBoxCommand(List drawableList, double x, double y, double width, double height, int textFontSize, string text, Color color, bool isBold, bool isItalic) + public InfiniteCanvasCreateTextBoxCommand(List drawableList, double x, double y, double width, double height, float textFontSize, string text, Color color, bool isBold, bool isItalic) { _drawable = new TextDrawable( x, diff --git a/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/Controls/InfiniteCanvasVirtualDrawingSurface.Commands.cs b/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/Controls/InfiniteCanvasVirtualDrawingSurface.Commands.cs index 7350db53d..d2ef41bfa 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/Controls/InfiniteCanvasVirtualDrawingSurface.Commands.cs +++ b/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/Controls/InfiniteCanvasVirtualDrawingSurface.Commands.cs @@ -79,7 +79,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls ExecuteCommand(command); } - internal void ExecuteCreateTextBox(double x, double y, double width, double height, int textFontSize, string text, Color color, bool isBold, bool isItalic) + internal void ExecuteCreateTextBox(double x, double y, double width, double height, float textFontSize, string text, Color color, bool isBold, bool isItalic) { var command = new InfiniteCanvasCreateTextBoxCommand(_drawableList, x, y, width, height, textFontSize, text, color, isBold, isItalic); ExecuteCommand(command); diff --git a/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.TextBox.cs b/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.TextBox.cs index 9b1d5ff3a..32c03cfc8 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.TextBox.cs +++ b/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.TextBox.cs @@ -35,16 +35,16 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls private TextDrawable SelectedTextDrawable => _drawingSurfaceRenderer.GetSelectedTextDrawable(); - private int _lastValidTextFontSizeValue = DefaultFontValue; + private float _lastValidTextFontSizeValue = DefaultFontValue; - private int TextFontSize + private float TextFontSize { get { if (!string.IsNullOrWhiteSpace(_canvasComboBoxFontSizeTextBox.SelectedValue.ToString()) && Regex.IsMatch(_canvasComboBoxFontSizeTextBox.Text, "^[0-9]*$")) { - var fontSize = int.Parse((_canvasComboBoxFontSizeTextBox.SelectedItem as ComboBoxItem).Content.ToString()); + var fontSize = float.Parse((_canvasComboBoxFontSizeTextBox.SelectedItem as ComboBoxItem).Content.ToString()); _lastValidTextFontSizeValue = fontSize; } From 9878a505b11ae5839cb7dd48f155315a0f0860ba Mon Sep 17 00:00:00 2001 From: Rosario Pulella Date: Fri, 9 Apr 2021 13:31:56 -0400 Subject: [PATCH 14/18] Only update font size on select font or on enter for text input --- .../InfiniteCanvas/InfiniteCanvas.TextBox.cs | 73 ++++++++++--------- .../InfiniteCanvas/InfiniteCanvas.cs | 4 +- 2 files changed, 43 insertions(+), 34 deletions(-) diff --git a/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.TextBox.cs b/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.TextBox.cs index 32c03cfc8..8dfc02675 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.TextBox.cs +++ b/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.TextBox.cs @@ -28,28 +28,20 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls "Right", "Up", "Left", - "Down" + "Down", + "Enter" }; private Point _lastInputPoint; private TextDrawable SelectedTextDrawable => _drawingSurfaceRenderer.GetSelectedTextDrawable(); - private float _lastValidTextFontSizeValue = DefaultFontValue; + private float _textFontSize = DefaultFontValue; - private float TextFontSize + private void SetFontSize(float newSize) { - get - { - if (!string.IsNullOrWhiteSpace(_canvasComboBoxFontSizeTextBox.SelectedValue.ToString()) && - Regex.IsMatch(_canvasComboBoxFontSizeTextBox.Text, "^[0-9]*$")) - { - var fontSize = float.Parse((_canvasComboBoxFontSizeTextBox.SelectedItem as ComboBoxItem).Content.ToString()); - _lastValidTextFontSizeValue = fontSize; - } - - return _lastValidTextFontSizeValue; - } + _textFontSize = newSize; + _canvasTextBox.UpdateFontSize(newSize); } private void InkScrollViewer_PreviewKeyDown(object sender, KeyRoutedEventArgs e) @@ -95,11 +87,26 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls private void CanvasComboBoxFontSizeTextBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { - _canvasTextBox.UpdateFontSize(TextFontSize); - if (SelectedTextDrawable != null) + if (sender is ComboBox s + && s.SelectedItem is ComboBoxItem selectedItem + && selectedItem.Content is string selectedText + && float.TryParse(selectedText, out var sizeNumb)) { - _drawingSurfaceRenderer.ExecuteUpdateTextBoxFontSize(TextFontSize); - ReDrawCanvas(); + SetFontSize(sizeNumb); + + if (SelectedTextDrawable != null) + { + _drawingSurfaceRenderer.ExecuteUpdateTextBoxFontSize(sizeNumb); + ReDrawCanvas(); + } + } + } + + private void CanvasComboBoxFontSizeTextBox_TextSubmitted(ComboBox sender, ComboBoxTextSubmittedEventArgs args) + { + if (float.TryParse(args.Text, out var size)) + { + SetFontSize(size); } } @@ -147,20 +154,22 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls ReDrawCanvas(); return; } + else + { + _drawingSurfaceRenderer.ExecuteCreateTextBox( + _lastInputPoint.X, + _lastInputPoint.Y, + _canvasTextBox.GetEditZoneWidth(), + _canvasTextBox.GetEditZoneHeight(), + _textFontSize, + text, + _canvasTextBoxColorPicker.Color, + _canvasTextBoxBoldButton.IsChecked ?? false, + _canvasTextBoxItalicButton.IsChecked ?? false); - _drawingSurfaceRenderer.ExecuteCreateTextBox( - _lastInputPoint.X, - _lastInputPoint.Y, - _canvasTextBox.GetEditZoneWidth(), - _canvasTextBox.GetEditZoneHeight(), - TextFontSize, - text, - _canvasTextBoxColorPicker.Color, - _canvasTextBoxBoldButton.IsChecked ?? false, - _canvasTextBoxItalicButton.IsChecked ?? false); - - ReDrawCanvas(); - _drawingSurfaceRenderer.UpdateSelectedTextDrawable(); + ReDrawCanvas(); + _drawingSurfaceRenderer.UpdateSelectedTextDrawable(); + } } private void InkScrollViewer_PointerPressed(object sender, PointerRoutedEventArgs e) @@ -179,7 +188,6 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls Canvas.SetLeft(_canvasTextBox, SelectedTextDrawable.Bounds.X); Canvas.SetTop(_canvasTextBox, SelectedTextDrawable.Bounds.Y); - _canvasTextBox.UpdateFontSize(SelectedTextDrawable.FontSize); _canvasTextBox.UpdateFontStyle(SelectedTextDrawable.IsItalic); _canvasTextBox.UpdateFontWeight(SelectedTextDrawable.IsBold); @@ -192,7 +200,6 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls return; } - _canvasTextBox.UpdateFontSize(TextFontSize); _canvasTextBox.UpdateFontStyle(_canvasTextBoxItalicButton.IsChecked ?? false); _canvasTextBox.UpdateFontWeight(_canvasTextBoxBoldButton.IsChecked ?? false); diff --git a/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.cs b/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.cs index abdd3c099..d5bef7834 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.cs +++ b/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.cs @@ -315,6 +315,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls Application.Current.LeavingBackground -= Current_LeavingBackground; _drawingSurfaceRenderer.CommandExecuted -= DrawingSurfaceRenderer_CommandExecuted; _canvasComboBoxFontSizeTextBox.PreviewKeyDown -= CanvasComboBoxFontSizeTextBox_PreviewKeyDown; + _canvasComboBoxFontSizeTextBox.TextSubmitted -= CanvasComboBoxFontSizeTextBox_TextSubmitted; Loaded -= InfiniteCanvas_Loaded; } @@ -339,6 +340,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls Application.Current.LeavingBackground += Current_LeavingBackground; _drawingSurfaceRenderer.CommandExecuted += DrawingSurfaceRenderer_CommandExecuted; _canvasComboBoxFontSizeTextBox.PreviewKeyDown += CanvasComboBoxFontSizeTextBox_PreviewKeyDown; + _canvasComboBoxFontSizeTextBox.TextSubmitted += CanvasComboBoxFontSizeTextBox_TextSubmitted; Loaded += InfiniteCanvas_Loaded; } @@ -366,7 +368,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls SetCanvasWidthHeight(); - _canvasTextBox.UpdateFontSize(TextFontSize); + SetFontSize(_textFontSize); } private void SetZoomFactor() From 90e648c7dfbf29ca2c49d0a08fba898124447634 Mon Sep 17 00:00:00 2001 From: Rosario Pulella Date: Fri, 9 Apr 2021 13:35:59 -0400 Subject: [PATCH 15/18] Allow FontSize comboox expand for larger number --- .../InfiniteCanvas/InfiniteCanvas.xaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.xaml b/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.xaml index 8530bff3b..91214027b 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.xaml +++ b/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.xaml @@ -98,7 +98,7 @@ Date: Fri, 9 Apr 2021 14:05:00 -0400 Subject: [PATCH 16/18] No need to update font textbox text --- .../InfiniteCanvas/InfiniteCanvas.TextBox.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.TextBox.cs b/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.TextBox.cs index 8dfc02675..bdfdcb254 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.TextBox.cs +++ b/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.TextBox.cs @@ -193,7 +193,6 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls // Updating toolbar _canvasTextBoxColorPicker.Color = SelectedTextDrawable.TextColor; - _canvasComboBoxFontSizeTextBox.Text = SelectedTextDrawable.FontSize.ToString(); _canvasTextBoxBoldButton.IsChecked = SelectedTextDrawable.IsBold; _canvasTextBoxItalicButton.IsChecked = SelectedTextDrawable.IsItalic; From 196dad90f8206b6508c8ccf1445e783ec192eac1 Mon Sep 17 00:00:00 2001 From: Rosario Pulella Date: Tue, 13 Apr 2021 16:15:38 -0400 Subject: [PATCH 17/18] Update fontsize of drawing surface on textsubmitted --- .../InfiniteCanvas/InfiniteCanvas.TextBox.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.TextBox.cs b/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.TextBox.cs index bdfdcb254..6839d59e1 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.TextBox.cs +++ b/Microsoft.Toolkit.Uwp.UI.Controls.Media/InfiniteCanvas/InfiniteCanvas.TextBox.cs @@ -107,6 +107,12 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls if (float.TryParse(args.Text, out var size)) { SetFontSize(size); + + if (SelectedTextDrawable != null) + { + _drawingSurfaceRenderer.ExecuteUpdateTextBoxFontSize(size); + ReDrawCanvas(); + } } } From 509877e04984ce4635e4756962d03eaa09692f50 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Wed, 31 Mar 2021 13:48:17 +0200 Subject: [PATCH 18/18] Added solution filter for .NET projects --- Windows Community Toolkit (NET).slnf | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Windows Community Toolkit (NET).slnf diff --git a/Windows Community Toolkit (NET).slnf b/Windows Community Toolkit (NET).slnf new file mode 100644 index 000000000..82ef79435 --- /dev/null +++ b/Windows Community Toolkit (NET).slnf @@ -0,0 +1,15 @@ +{ + "solution": { + "path": "Windows Community Toolkit.sln", + "projects": [ + "Microsoft.Toolkit.Diagnostics\\Microsoft.Toolkit.Diagnostics.csproj", + "Microsoft.Toolkit.HighPerformance\\Microsoft.Toolkit.HighPerformance.csproj", + "Microsoft.Toolkit.Mvvm\\Microsoft.Toolkit.Mvvm.csproj", + "Microsoft.Toolkit\\Microsoft.Toolkit.csproj", + "UnitTests\\UnitTests.HighPerformance.NetCore\\UnitTests.HighPerformance.NetCore.csproj", + "UnitTests\\UnitTests.HighPerformance.Shared\\UnitTests.HighPerformance.Shared.shproj", + "UnitTests\\UnitTests.NetCore\\UnitTests.NetCore.csproj", + "UnitTests\\UnitTests.Shared\\UnitTests.Shared.shproj" + ] + } +} \ No newline at end of file