From 873e41201377965d45187e20264f17df6cbf0e55 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Sun, 14 Sep 2014 14:38:28 +0200 Subject: [PATCH] Align treeview node expanders properly. --- Perspex/Shapes/Shape.cs | 12 ++++++------ Perspex/Themes/Default/TreeViewItemStyle.cs | 5 ++--- TestApplication/Program.cs | 1 + 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Perspex/Shapes/Shape.cs b/Perspex/Shapes/Shape.cs index 8eeb1742d2..478e0a061e 100644 --- a/Perspex/Shapes/Shape.cs +++ b/Perspex/Shapes/Shape.cs @@ -70,22 +70,22 @@ namespace Perspex.Shapes if (double.IsInfinity(availableSize.Width)) { - desiredX = shapeBounds.Width; + desiredX = shapeBounds.Right; } if (double.IsInfinity(availableSize.Height)) { - desiredY = shapeBounds.Height; + desiredY = shapeBounds.Bottom; } if (shapeBounds.Width > 0) { - sx = desiredX / shapeBounds.Width; + sx = desiredX / shapeBounds.Right; } if (shapeBounds.Height > 0) { - sy = desiredY / shapeBounds.Height; + sy = desiredY / shapeBounds.Bottom; } if (double.IsInfinity(availableSize.Width)) @@ -123,8 +123,8 @@ namespace Perspex.Shapes break; } - double finalX = (width > 0) ? width : shapeBounds.Width * sx; - double finalY = (height > 0) ? height : shapeBounds.Height * sy; + double finalX = (width > 0) ? width : shapeBounds.Right * sx; + double finalY = (height > 0) ? height : shapeBounds.Bottom * sy; return new Size(finalX, finalY); } diff --git a/Perspex/Themes/Default/TreeViewItemStyle.cs b/Perspex/Themes/Default/TreeViewItemStyle.cs index 2395af85a3..56253129e0 100644 --- a/Perspex/Themes/Default/TreeViewItemStyle.cs +++ b/Perspex/Themes/Default/TreeViewItemStyle.cs @@ -74,10 +74,9 @@ namespace Perspex.Themes.Default Fill = Brushes.Black, Stroke = Brushes.Black, StrokeThickness = 1, - Width = 16, - Height = 16, + Margin = new Thickness(3, 0), VerticalAlignment = Layout.VerticalAlignment.Center, - Data = StreamGeometry.Parse("M 4 0 L 8 4 L 4 8 Z"), + Data = StreamGeometry.Parse("M 0 2 L 4 6 L 0 10 Z"), }; } } diff --git a/TestApplication/Program.cs b/TestApplication/Program.cs index b949112646..977e682efe 100644 --- a/TestApplication/Program.cs +++ b/TestApplication/Program.cs @@ -172,6 +172,7 @@ namespace TestApplication new TabItem { Header = "Lists", + IsSelected = true, Content = new StackPanel { Orientation = Orientation.Vertical,