diff --git a/Xamarin.Forms.Controls/GalleryPages/CollectionViewGalleries/EmptyViewGalleries/EmptyViewTemplateGallery.xaml b/Xamarin.Forms.Controls/GalleryPages/CollectionViewGalleries/EmptyViewGalleries/EmptyViewTemplateGallery.xaml
index b94c26882..da3560433 100644
--- a/Xamarin.Forms.Controls/GalleryPages/CollectionViewGalleries/EmptyViewGalleries/EmptyViewTemplateGallery.xaml
+++ b/Xamarin.Forms.Controls/GalleryPages/CollectionViewGalleries/EmptyViewGalleries/EmptyViewTemplateGallery.xaml
@@ -20,7 +20,7 @@
+ Text="{Binding Filter, StringFormat='Your filter term of {0} did not match any records'}">
diff --git a/Xamarin.Forms.Xaml.UnitTests/Issues/Gh2756.xaml b/Xamarin.Forms.Xaml.UnitTests/Issues/Gh2756.xaml
deleted file mode 100644
index ada0d2ca5..000000000
--- a/Xamarin.Forms.Xaml.UnitTests/Issues/Gh2756.xaml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
diff --git a/Xamarin.Forms.Xaml.UnitTests/Issues/Gh2756.xaml.cs b/Xamarin.Forms.Xaml.UnitTests/Issues/Gh2756.xaml.cs
deleted file mode 100644
index 52fbbd91e..000000000
--- a/Xamarin.Forms.Xaml.UnitTests/Issues/Gh2756.xaml.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-using NUnit.Framework;
-
-using Xamarin.Forms.Core.UnitTests;
-
-using Xamarin.Forms;
-
-namespace Xamarin.Forms.Xaml.UnitTests
-{
- [XamlCompilation(XamlCompilationOptions.Skip)]
- public partial class Gh2756 : ContentPage
- {
- public Gh2756() => InitializeComponent();
- public Gh2756(bool useCompiledXaml)
- {
- //this stub will be replaced at compile time
- }
-
- [TestFixture]
- class Tests
- {
- [SetUp] public void Setup() => Device.PlatformServices = new MockPlatformServices();
- [TearDown] public void TearDown() => Device.PlatformServices = null;
-
- [Test]
- public void UnescapedBraces([Values(false, true)]bool useCompiledXaml)
- {
- if (useCompiledXaml)
- Assert.Throws(new XamlParseExceptionConstraint(8, 16), () => MockCompiler.Compile(typeof(Gh2756)));
- else
- Assert.Throws(new XamlParseExceptionConstraint(8, 16), () => new Gh2756(useCompiledXaml));
- }
- }
- }
-}
diff --git a/Xamarin.Forms.Xaml.UnitTests/Issues/Issue1438.xaml b/Xamarin.Forms.Xaml.UnitTests/Issues/Issue1438.xaml
index 442700fea..f31c52ab1 100644
--- a/Xamarin.Forms.Xaml.UnitTests/Issues/Issue1438.xaml
+++ b/Xamarin.Forms.Xaml.UnitTests/Issues/Issue1438.xaml
@@ -1,4 +1,4 @@
-
+
diff --git a/Xamarin.Forms.Xaml.UnitTests/Issues/Issue1549.cs b/Xamarin.Forms.Xaml.UnitTests/Issues/Issue1549.cs
index 8e59a3064..e73123c3b 100644
--- a/Xamarin.Forms.Xaml.UnitTests/Issues/Issue1549.cs
+++ b/Xamarin.Forms.Xaml.UnitTests/Issues/Issue1549.cs
@@ -82,7 +82,7 @@ xmlns=""http://xamarin.com/schemas/2014/forms""
- ";
+
+ var layout = new ContentPage().LoadFromXaml(xaml);
+ layout.BindingContext = new { Value = "Foo", Severity = "Bar" };
+ var label = layout.FindByName("label");
+ Assert.AreEqual(Color.Blue, label.BackgroundColor);
+ Assert.AreEqual(1, SeverityColorConverter.count);
+ }
+
[Test]
public void ResourcesInNonXFBaseClassesAreFound ()
{
diff --git a/Xamarin.Forms.Xaml.UnitTests/MarkupExpressionParserTests.cs b/Xamarin.Forms.Xaml.UnitTests/MarkupExpressionParserTests.cs
index 5e00e1edc..37ba17008 100644
--- a/Xamarin.Forms.Xaml.UnitTests/MarkupExpressionParserTests.cs
+++ b/Xamarin.Forms.Xaml.UnitTests/MarkupExpressionParserTests.cs
@@ -248,25 +248,17 @@ namespace Xamarin.Forms.Xaml.UnitTests
}
[Test]
- public void NonStartingBracesDoNotNeedToBeEscaped()
+ public void BindingStringFormatWithoutEscaping ()
{
- var bindingString = "{Binding Foo, StringFormat='Hello {0}'}";
+ var bindingString = "{Binding Foo, StringFormat='{0,20}'}";
- Assert.DoesNotThrow(() => new MarkupExtensionParser().ParseExpression(ref bindingString, new Internals.XamlServiceProvider(null, null)
- {
+ var binding = (new MarkupExtensionParser ()).ParseExpression (ref bindingString, new Internals.XamlServiceProvider (null, null) {
IXamlTypeResolver = typeResolver,
- }));
- }
+ });
- [Test]
- public void BracesNeedsToBeEscaped2()
- {
- var bindingString = "{Binding Foo, StringFormat='{0}'}";
-
- Assert.Throws(() => new MarkupExtensionParser().ParseExpression(ref bindingString, new Internals.XamlServiceProvider(null, null)
- {
- IXamlTypeResolver = typeResolver,
- }));
+ Assert.That (binding, Is.InstanceOf ());
+ Assert.AreEqual ("Foo", ((Binding)binding).Path);
+ Assert.AreEqual ("{0,20}", ((Binding)binding).StringFormat);
}
[Test]
diff --git a/Xamarin.Forms.Xaml/MarkupExpressionParser.cs b/Xamarin.Forms.Xaml/MarkupExpressionParser.cs
index 7be820dc9..9123a7202 100644
--- a/Xamarin.Forms.Xaml/MarkupExpressionParser.cs
+++ b/Xamarin.Forms.Xaml/MarkupExpressionParser.cs
@@ -46,10 +46,7 @@ namespace Xamarin.Forms.Xaml
return expression.Substring(2);
if (expression[expression.Length - 1] != '}')
- {
- var lineInfo = (serviceProvider.GetService(typeof(IXmlLineInfoProvider)) as IXmlLineInfoProvider != null) ? (serviceProvider.GetService(typeof(IXmlLineInfoProvider)) as IXmlLineInfoProvider).XmlLineInfo : new XmlLineInfo();
- throw new XamlParseException("Expression must end with '}'", lineInfo);
- }
+ throw new Exception("Expression must end with '}'");
int len;
string match;
@@ -117,6 +114,7 @@ namespace Xamarin.Forms.Xaml
protected void HandleProperty(string prop, IServiceProvider serviceProvider, ref string remaining, bool isImplicit)
{
+ char next;
object value = null;
string str_value;
@@ -139,13 +137,7 @@ namespace Xamarin.Forms.Xaml
str_value = value as string;
}
else
- str_value = GetNextPiece(ref remaining, out var next);
-
- if (str_value != null && !str_value.StartsWith("{}", StringComparison.Ordinal) && str_value.Length > 2 && str_value.StartsWith("{", StringComparison.Ordinal))
- {
- var lineInfo = (serviceProvider.GetService(typeof(IXmlLineInfoProvider)) as IXmlLineInfoProvider != null) ? (serviceProvider.GetService(typeof(IXmlLineInfoProvider)) as IXmlLineInfoProvider).XmlLineInfo : new XmlLineInfo();
- throw new XamlParseException("Strings starting with `{` needs to be escaped. Start the string with `{}`", lineInfo);
- }
+ str_value = GetNextPiece(ref remaining, out next);
SetPropertyValue(prop, str_value, value, serviceProvider);
}
diff --git a/Xamarin.Forms.Xaml/MarkupExtensionParser.cs b/Xamarin.Forms.Xaml/MarkupExtensionParser.cs
index 439c859d5..086c12b01 100644
--- a/Xamarin.Forms.Xaml/MarkupExtensionParser.cs
+++ b/Xamarin.Forms.Xaml/MarkupExtensionParser.cs
@@ -5,31 +5,27 @@ namespace Xamarin.Forms.Xaml
{
internal sealed class MarkupExtensionParser : MarkupExpressionParser, IExpressionParser