diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/MarkupExtensionParser.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/MarkupExtensionParser.cs index 6fcfa1fe59..713701b963 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/MarkupExtensionParser.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/MarkupExtensionParser.cs @@ -96,12 +96,17 @@ namespace ICSharpCode.WpfDesign.XamlDom if (text[pos] == '"' || text[pos] == '\'') { char quote = text[pos++]; CheckNotEOF(); + int lastBackslashPos = -1; while (!(text[pos] == quote && text[pos-1] != '\\')) { - char prev = text[pos-1]; + int current = pos; char c = text[pos++]; - bool isEscapedBackslash = string.Concat(prev,c)=="\\\\"; - if (c != '\\' || isEscapedBackslash) + //check if string is \\ and that the last backslash is not the previously saved char, ie that \\\\ does not become \\\ but just \\ + bool isEscapedBackslash = string.Concat(text[current-1],c)=="\\\\" && current-1 != lastBackslashPos; + if (c != '\\' || isEscapedBackslash){ b.Append(c); + if(isEscapedBackslash) + lastBackslashPos = current; + } CheckNotEOF(); } pos++; // consume closing quote