Browse Source

Don't Clear Name on copied Elements, change the name to "_Copy","_Copy1","_Copy2"....

pull/52/head
jkuehner 12 years ago
parent
commit
6a0f73eb2c
  1. 18
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Xaml/XamlComponentService.cs

18
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; var nameScope = _context.RootItem.Component as INameScope;
nameScope = NameScope.GetNameScope((DependencyObject) _context.RootItem.Component); nameScope = NameScope.GetNameScope((DependencyObject) _context.RootItem.Component);
var fnd = nameScope.FindName(site.Name); 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; return site;
} }

Loading…
Cancel
Save