From a1438e1e5efcc554b46113f82fc02c5e75eae31f Mon Sep 17 00:00:00 2001 From: gumme Date: Mon, 17 Jun 2013 11:49:31 +0200 Subject: [PATCH] Removing the optional "Extension" suffix from Markup Extension name if present. --- .../WpfDesign/WpfDesign.XamlDom/Project/XamlObject.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/XamlObject.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/XamlObject.cs index d9cb3b1aa6..2c94500487 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/XamlObject.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/XamlObject.cs @@ -353,7 +353,16 @@ namespace ICSharpCode.WpfDesign.XamlDom internal string GetNameForMarkupExtension() { - return XmlElement.Name; + string markupExtensionName = XmlElement.Name; + + // By convention a markup extension class name typically includes an "Extension" suffix. + // When you reference the markup extension in XAML the "Extension" suffix is optional. + // If present remove it to avoid bloating the XAML. + if (markupExtensionName.EndsWith("Extension", StringComparison.Ordinal)) { + markupExtensionName = markupExtensionName.Substring(0, markupExtensionName.Length - 9); + } + + return markupExtensionName; } }