diff --git a/src/Avalonia.Visuals/Vector.cs b/src/Avalonia.Visuals/Vector.cs
index 576d2daaaa..d99fbe8e65 100644
--- a/src/Avalonia.Visuals/Vector.cs
+++ b/src/Avalonia.Visuals/Vector.cs
@@ -4,6 +4,7 @@
using System;
using System.Globalization;
using Avalonia.Animation.Animators;
+using Avalonia.Utilities;
using JetBrains.Annotations;
namespace Avalonia
@@ -85,6 +86,22 @@ namespace Avalonia
public static Vector operator /(Vector vector, double scale)
=> Divide(vector, scale);
+ ///
+ /// Parses a string.
+ ///
+ /// The string.
+ /// The .
+ public static Vector Parse(string s)
+ {
+ using (var tokenizer = new StringTokenizer(s, CultureInfo.InvariantCulture, exceptionMessage: "Invalid Vector."))
+ {
+ return new Vector(
+ tokenizer.ReadDouble(),
+ tokenizer.ReadDouble()
+ );
+ }
+ }
+
///
/// Length of the vector
///
@@ -166,9 +183,9 @@ namespace Avalonia
}
///
- /// Returns the string representation of the point.
+ /// Returns the string representation of the vector.
///
- /// The string representation of the point.
+ /// The string representation of the vector.
public override string ToString()
{
return string.Format(CultureInfo.InvariantCulture, "{0}, {1}", _x, _y);