diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Xaml/XamlComponentService.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Xaml/XamlComponentService.cs index 931ebafa9a..edbb41d40d 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Xaml/XamlComponentService.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Xaml/XamlComponentService.cs @@ -93,8 +93,22 @@ namespace ICSharpCode.WpfDesign.Designer.Xaml var nameScope = _context.RootItem.Component as INameScope; nameScope = NameScope.GetNameScope((DependencyObject) _context.RootItem.Component); var fnd = nameScope.FindName(site.Name); - if (fnd != null) - site.Name = null; + + if (fnd != null) { + string newNm = site.Name + "_Copy"; + fnd = nameScope.FindName(newNm); + if (fnd == null) + site.Name = newNm; + else { + int i = 1; + while (fnd != null) { + newNm = site.Name + "_Copy" + i; + fnd = nameScope.FindName(newNm); + i++; + } + site.Name = newNm; + } + } } return site; }