From cd6470753e2853f7949e285a5c7a15bb9bf1848c Mon Sep 17 00:00:00 2001 From: William Kent Date: Thu, 13 Feb 2020 13:45:37 -0500 Subject: [PATCH 01/13] Use ContentControl in DocumentGridPage --- .../MS/Internal/documents/DocumentGridPage.cs | 78 ++++--------------- 1 file changed, 14 insertions(+), 64 deletions(-) diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/documents/DocumentGridPage.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/documents/DocumentGridPage.cs index bf524e5dfdf..ec4c55333b0 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/documents/DocumentGridPage.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/documents/DocumentGridPage.cs @@ -182,17 +182,13 @@ protected override Visual GetVisualChild(int index) { CheckDisposed(); - // count is either 0 or 3 + // count is either 0 or 1 if (VisualChildrenCount != 0) { switch (index) { case 0: - return _dropShadowRight; - case 1: - return _dropShadowBottom; - case 2: - return _pageBorder; + return _documentContainer; default: throw new ArgumentOutOfRangeException("index", index, SR.Get(SRID.Visual_ArgumentOutOfRange)); } @@ -215,7 +211,7 @@ protected override int VisualChildrenCount get { if (!_disposed && hasAddedChildren) - return 3; + return 1; else return 0; } @@ -233,12 +229,10 @@ protected override sealed Size MeasureOverride(Size availableSize) if (!hasAddedChildren) { - //Add the drop shadow - this.AddVisualChild(_dropShadowRight); - this.AddVisualChild(_dropShadowBottom); + _documentContainer = new ContentControl(); + _documentContainer.Content = _pageBorder; - //Add the page (inside the pageBorder) - this.AddVisualChild(_pageBorder); + this.AddVisualChild(_documentContainer); hasAddedChildren = true; } @@ -247,23 +241,16 @@ protected override sealed Size MeasureOverride(Size availableSize) //state of the ShowPageBorders property. if (ShowPageBorders) { - _pageBorder.BorderThickness = _pageBorderVisibleThickness; - _pageBorder.Background = Brushes.White; - _dropShadowRight.Opacity = _dropShadowOpacity; - _dropShadowBottom.Opacity = _dropShadowOpacity; + _documentContainer.SetCurrentValue(DefaultStyleKeyProperty, + new ComponentResourceKey(typeof(FrameworkElement), "DocumentGridPageContainerWithBorder")); } else { - _pageBorder.BorderThickness = _pageBorderInvisibleThickness; - _pageBorder.Background = Brushes.Transparent; - _dropShadowRight.Opacity = 0.0; - _dropShadowBottom.Opacity = 0.0; + _documentContainer.SetCurrentValue(DefaultStyleKeyProperty, null); } //Measure our children. - _dropShadowRight.Measure(availableSize); - _dropShadowBottom.Measure(availableSize); - _pageBorder.Measure(availableSize); + _documentContainer.Measure(availableSize); //Set the Page Zoom on the DocumentPageView to the ratio between our measure constraint //and the actual size of the page; this will cause the DPV to scale our page appropriately. @@ -283,26 +270,8 @@ protected override sealed Size ArrangeOverride(Size arrangeSize) { CheckDisposed(); - //Arrange the page, no offset. - _pageBorder.Arrange(new Rect(new Point(0.0, 0.0), arrangeSize)); - - //Arrange the drop shadow parts along the right - //and bottom edges of the page. - - //Right edge - as tall as the page (minus the shadow width so we don't overlap - //with the bottom edge), 5px wide. Offset vertically by 5px. - _dropShadowRight.Arrange( - new Rect( - new Point(arrangeSize.Width, _dropShadowWidth), - new Size(_dropShadowWidth, Math.Max(0.0, arrangeSize.Height - _dropShadowWidth)) - )); - - //Bottom edge - 5px tall, and as wide as the page. Offset horizontally by 5px. - _dropShadowBottom.Arrange( - new Rect( - new Point(_dropShadowWidth, arrangeSize.Height), - new Size(arrangeSize.Width, _dropShadowWidth) - )); + //Arrange the page container, no offset. + _documentContainer.Arrange(new Rect(new Point(0.0, 0.0), arrangeSize)); base.ArrangeOverride(arrangeSize); return arrangeSize; @@ -330,21 +299,10 @@ private void Init() _documentPageView.StretchDirection = StretchDirection.Both; _documentPageView.PageNumber = int.MaxValue; - //Create the border that goes around the page content. + //Create the border that contains the page content. _pageBorder = new Border(); - _pageBorder.BorderBrush = Brushes.Black; _pageBorder.Child = _documentPageView; - //Create the drop shadow that goes behind the page, made - //of two rectangles in an "L" shape. - _dropShadowRight = new Rectangle(); - _dropShadowRight.Fill = Brushes.Black; - _dropShadowRight.Opacity = _dropShadowOpacity; - - _dropShadowBottom = new Rectangle(); - _dropShadowBottom.Fill = Brushes.Black; - _dropShadowBottom.Opacity = _dropShadowOpacity; - _loaded = false; } @@ -439,20 +397,12 @@ void IDisposable.Dispose() private bool hasAddedChildren; private DocumentPaginator _paginator; private DocumentPageView _documentPageView; - private Rectangle _dropShadowRight; - private Rectangle _dropShadowBottom; private Border _pageBorder; + private ContentControl _documentContainer; private bool _showPageBorders; private bool _loaded; - - //Constants - private const double _dropShadowOpacity = 0.35; - private const double _dropShadowWidth = 5.0; - private readonly Thickness _pageBorderVisibleThickness = new Thickness(1, 1, 1, 1); - private readonly Thickness _pageBorderInvisibleThickness = new Thickness(0, 0, 0, 0); - private bool _disposed; #endregion Private Fields From e0782072d90c45b66d0e90cabae2e850e51b5c79 Mon Sep 17 00:00:00 2001 From: William Kent Date: Thu, 13 Feb 2020 13:57:49 -0500 Subject: [PATCH 02/13] Get rid of now-unused Border --- .../MS/Internal/documents/DocumentGridPage.cs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/documents/DocumentGridPage.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/documents/DocumentGridPage.cs index ec4c55333b0..4984784639d 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/documents/DocumentGridPage.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/documents/DocumentGridPage.cs @@ -229,9 +229,6 @@ protected override sealed Size MeasureOverride(Size availableSize) if (!hasAddedChildren) { - _documentContainer = new ContentControl(); - _documentContainer.Content = _pageBorder; - this.AddVisualChild(_documentContainer); hasAddedChildren = true; @@ -299,9 +296,9 @@ private void Init() _documentPageView.StretchDirection = StretchDirection.Both; _documentPageView.PageNumber = int.MaxValue; - //Create the border that contains the page content. - _pageBorder = new Border(); - _pageBorder.Child = _documentPageView; + //Create the content control that contains the page content. + _documentContainer = new ContentControl(); + _documentContainer.Content = _documentPageView; _loaded = false; } @@ -397,7 +394,6 @@ void IDisposable.Dispose() private bool hasAddedChildren; private DocumentPaginator _paginator; private DocumentPageView _documentPageView; - private Border _pageBorder; private ContentControl _documentContainer; private bool _showPageBorders; From 6c7611125fe5bb0ee4cb8f991be93d8810ee566a Mon Sep 17 00:00:00 2001 From: William Kent Date: Thu, 13 Feb 2020 14:07:23 -0500 Subject: [PATCH 03/13] Modify ThemeGenerator.nativeproj to be usable again --- ...nerator.nativeproj => ThemeGenerator.proj} | 179 ++++++++---------- 1 file changed, 82 insertions(+), 97 deletions(-) rename src/Microsoft.DotNet.Wpf/src/Themes/Generator/{ThemeGenerator.nativeproj => ThemeGenerator.proj} (59%) diff --git a/src/Microsoft.DotNet.Wpf/src/Themes/Generator/ThemeGenerator.nativeproj b/src/Microsoft.DotNet.Wpf/src/Themes/Generator/ThemeGenerator.proj similarity index 59% rename from src/Microsoft.DotNet.Wpf/src/Themes/Generator/ThemeGenerator.nativeproj rename to src/Microsoft.DotNet.Wpf/src/Themes/Generator/ThemeGenerator.proj index 04891b0a07f..ce75bc11c9c 100644 --- a/src/Microsoft.DotNet.Wpf/src/Themes/Generator/ThemeGenerator.nativeproj +++ b/src/Microsoft.DotNet.Wpf/src/Themes/Generator/ThemeGenerator.proj @@ -1,97 +1,82 @@ - - - - - - COPY - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - GenerateThemes; - $(BuildGeneratedDependsOn) - - - - - - - - - - - - sdk - - - - - + + + + + + $(MSBuildThisFileDirectory)..\ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 601478a12345a6ab550350d81798c081e12b3f2a Mon Sep 17 00:00:00 2001 From: William Kent Date: Thu, 13 Feb 2020 14:08:39 -0500 Subject: [PATCH 04/13] Add DocumentGridPageContainerWithBorder style --- .../src/Themes/XAML/DocumentViewer.xaml | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/Microsoft.DotNet.Wpf/src/Themes/XAML/DocumentViewer.xaml b/src/Microsoft.DotNet.Wpf/src/Themes/XAML/DocumentViewer.xaml index 7a3c15d7723..71744af662e 100644 --- a/src/Microsoft.DotNet.Wpf/src/Themes/XAML/DocumentViewer.xaml +++ b/src/Microsoft.DotNet.Wpf/src/Themes/XAML/DocumentViewer.xaml @@ -1201,3 +1201,35 @@ See the LICENSE file in the project root for more information. + + + + From 87359b93e9e420b1723fcf38547e45614ac10fa2 Mon Sep 17 00:00:00 2001 From: William Kent Date: Thu, 13 Feb 2020 14:08:48 -0500 Subject: [PATCH 05/13] Regenerate theme XAML files --- .../themes/Aero.NormalColor.xaml | 2082 +++++------ .../Themes/Aero2.NormalColor.xaml | 3130 +++++++++-------- .../Themes/AeroLite.NormalColor.xaml | 2759 ++++++++------- .../Themes/Classic.xaml | 2029 +++++------ .../Themes/Luna.HomeStead.xaml | 1873 +++++----- .../Themes/Luna.Metallic.xaml | 1889 +++++----- .../Themes/Luna.NormalColor.xaml | 1893 +++++----- .../Themes/Royale.NormalColor.xaml | 1897 +++++----- 8 files changed, 8895 insertions(+), 8657 deletions(-) diff --git a/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Aero/themes/Aero.NormalColor.xaml b/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Aero/themes/Aero.NormalColor.xaml index 9c213f0ca78..a72e60fea15 100644 --- a/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Aero/themes/Aero.NormalColor.xaml +++ b/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Aero/themes/Aero.NormalColor.xaml @@ -1,7 +1,8 @@ + - - - - - - - - - - - - - - - - - - + + + + + + + - + - + @@ -934,32 +935,32 @@ To automatically copy the files, set the environment variable - - - - - - - - - + + + + + + + + + @@ -991,7 +992,7 @@ To automatically copy the files, set the environment variable - + @@ -1064,7 +1065,7 @@ To automatically copy the files, set the environment variable - + @@ -1121,68 +1122,68 @@ To automatically copy the files, set the environment variable - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1190,30 +1191,60 @@ To automatically copy the files, set the environment variable - - - + + + + @@ -1666,9 +1697,9 @@ To automatically copy the files, set the environment variable - @@ -1682,7 +1713,7 @@ To automatically copy the files, set the environment variable @@ -1793,20 +1824,20 @@ To automatically copy the files, set the environment variable - + - + - +