Browse Source

Align treeview node expanders properly.

pull/4/head
Steven Kirk 12 years ago
parent
commit
873e412013
  1. 12
      Perspex/Shapes/Shape.cs
  2. 5
      Perspex/Themes/Default/TreeViewItemStyle.cs
  3. 1
      TestApplication/Program.cs

12
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);
}

5
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"),
};
}
}

1
TestApplication/Program.cs

@ -172,6 +172,7 @@ namespace TestApplication
new TabItem
{
Header = "Lists",
IsSelected = true,
Content = new StackPanel
{
Orientation = Orientation.Vertical,

Loading…
Cancel
Save