diff --git a/Perspex.Direct2D1/Media/StreamGeometryContextImpl.cs b/Perspex.Direct2D1/Media/StreamGeometryContextImpl.cs
index 2ad2ac928b..6d5d5fb9f5 100644
--- a/Perspex.Direct2D1/Media/StreamGeometryContextImpl.cs
+++ b/Perspex.Direct2D1/Media/StreamGeometryContextImpl.cs
@@ -6,10 +6,8 @@
namespace Perspex.Direct2D1.Media
{
- using System;
using Perspex.Media;
using SharpDX.Direct2D1;
- using Splat;
public class StreamGeometryContextImpl : IStreamGeometryContextImpl
{
diff --git a/Perspex/Controls/Decorator.cs b/Perspex/Controls/Decorator.cs
index b8d8963524..c2db2d1e21 100644
--- a/Perspex/Controls/Decorator.cs
+++ b/Perspex/Controls/Decorator.cs
@@ -77,6 +77,9 @@ namespace Perspex.Controls
protected override Size MeasureContent(Size availableSize)
{
+ double width = 0;
+ double height = 0;
+
if (this.Visibility != Visibility.Collapsed)
{
Control content = this.Content;
@@ -84,11 +87,23 @@ namespace Perspex.Controls
if (content != null)
{
content.Measure(availableSize);
- return content.DesiredSize.Value.Inflate(this.Padding);
+ Size s = content.DesiredSize.Value.Inflate(this.Padding);
+ width = s.Width;
+ height = s.Height;
+ }
+
+ if (this.Width > 0)
+ {
+ width = this.Width;
+ }
+
+ if (this.Height > 0)
+ {
+ height = this.Height;
}
}
- return new Size();
+ return new Size(width, height);
}
}
}
diff --git a/Perspex/Media/Brushes.cs b/Perspex/Media/Brushes.cs
new file mode 100644
index 0000000000..7ecba5d2a4
--- /dev/null
+++ b/Perspex/Media/Brushes.cs
@@ -0,0 +1,25 @@
+// -----------------------------------------------------------------------
+//
+// Copyright 2013 MIT Licence. See licence.md for more information.
+//
+// -----------------------------------------------------------------------
+
+namespace Perspex.Media
+{
+ ///
+ /// Predefined brushes.
+ ///
+ public static class Brushes
+ {
+ static Brushes()
+ {
+ Black = new SolidColorBrush(0xff000000);
+ }
+
+ public static SolidColorBrush Black
+ {
+ get;
+ private set;
+ }
+ }
+}
diff --git a/Perspex/Media/PathMarkupParser.cs b/Perspex/Media/PathMarkupParser.cs
index 4b58f0f11c..866160732d 100644
--- a/Perspex/Media/PathMarkupParser.cs
+++ b/Perspex/Media/PathMarkupParser.cs
@@ -67,7 +67,6 @@ namespace Perspex.Media
{
Command lastCommand = Command.None;
Command command;
- Point startPoint = new Point();
Point point = new Point();
while ((command = ReadCommand(reader, lastCommand)) != Command.Eof)
@@ -81,7 +80,12 @@ namespace Perspex.Media
case Command.Move:
case Command.MoveRelative:
- point = startPoint = ReadPoint(reader);
+ if (openFigure)
+ {
+ this.context.EndFigure(false);
+ }
+
+ point = ReadPoint(reader);
this.context.BeginFigure(point, true);
openFigure = true;
break;
@@ -139,7 +143,7 @@ namespace Perspex.Media
if (openFigure)
{
- this.context.EndFigure(true);
+ this.context.EndFigure(false);
}
}
}
@@ -158,7 +162,6 @@ namespace Perspex.Media
{
char c = (char)i;
Command command = Command.None;
- bool canMove = lastCommand == Command.None || lastCommand == Command.FillRule || lastCommand == Command.Close;
if (!Commands.TryGetValue(c, out command))
{
@@ -173,11 +176,6 @@ namespace Perspex.Media
}
}
- if (!canMove && command <= Command.MoveRelative)
- {
- command += 2;
- }
-
reader.Read();
return command;
}
diff --git a/Perspex/Perspex.csproj b/Perspex/Perspex.csproj
index a0347f8eff..5c7cd43d9c 100644
--- a/Perspex/Perspex.csproj
+++ b/Perspex/Perspex.csproj
@@ -82,6 +82,7 @@
+
diff --git a/Perspex/Themes/Default/CheckBoxStyle.cs b/Perspex/Themes/Default/CheckBoxStyle.cs
index 50264b3991..682d9b2369 100644
--- a/Perspex/Themes/Default/CheckBoxStyle.cs
+++ b/Perspex/Themes/Default/CheckBoxStyle.cs
@@ -56,13 +56,13 @@ namespace Perspex.Themes.Default
new Border
{
BorderThickness = 2,
- BorderBrush = new SolidColorBrush(Color.FromUInt32(0xff000000)),
+ BorderBrush = Brushes.Black,
Padding = new Thickness(8),
Content = new Path
{
Id = "checkMark",
- Data = StreamGeometry.Parse("M0,0 L10,10 Z M10,0 L0,10"),
- Stroke = new SolidColorBrush(Color.FromUInt32(0xff000000)),
+ Data = StreamGeometry.Parse("M0,0 L10,10 M10,0 L0,10"),
+ Stroke = Brushes.Black,
StrokeThickness = 2,
VerticalAlignment = VerticalAlignment.Center,
},
diff --git a/TestApplication/Program.cs b/TestApplication/Program.cs
index 21d5a2f380..a7e342c78d 100644
--- a/TestApplication/Program.cs
+++ b/TestApplication/Program.cs
@@ -9,6 +9,7 @@ using Perspex;
using Perspex.Controls;
using Perspex.Input;
using Perspex.Media;
+using Perspex.Shapes;
using Perspex.Styling;
using Perspex.Themes.Default;
using Perspex.Windows;
@@ -43,23 +44,36 @@ namespace TestApplication
Window window = new Window
{
- Content = new StackPanel
- {
+ Content = new StackPanel
+ {
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
Orientation = Orientation.Vertical,
Gap = 6,
- Children = new PerspexList
- {
- //new Button
- //{
- // Content = "Button",
- //},
- //new Button
- //{
- // Content = "Explict Background",
- // Background = new SolidColorBrush(0xffa0a0ff),
- //},
+ Children = new PerspexList
+ {
+ new Border
+ {
+ BorderBrush = Brushes.Black,
+ BorderThickness = 1,
+ Width = 10,
+ Height = 10,
+ },
+ new Path
+ {
+ Data = StreamGeometry.Parse("M0,0 L10,0"),
+ Stroke = Brushes.Black,
+ StrokeThickness = 1,
+ },
+ new Button
+ {
+ Content = "Button",
+ },
+ new Button
+ {
+ Content = "Explict Background",
+ Background = new SolidColorBrush(0xffa0a0ff),
+ },
new CheckBox
{
Content = "Checkbox",