Browse Source

x:name does not set the name property of a Control.

Now also Code like this:
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <Canvas>
    <Button x:Name="aa"
            Content="{Binding Name, ElementName=aa}"
            Width="75.2"
            Height="23.2"
            Canvas.Left="85.6"
            Canvas.Top="197.6" />
  </Canvas>
</Window>

works!
pull/63/head
jkuehner 12 years ago
parent
commit
a6b6e44fbb
  1. 8
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/NameScopeHelper.cs

8
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/NameScopeHelper.cs

@ -38,6 +38,14 @@ namespace ICSharpCode.WpfDesign.XamlDom @@ -38,6 +38,14 @@ namespace ICSharpCode.WpfDesign.XamlDom
}
if (newName != null) {
nameScope.RegisterName(newName, namedObject.Instance);
try{
var prp = namedObject.ElementType.GetProperty(namedObject.RuntimeNameProperty);
if (prp != null)
prp.SetValue(namedObject.Instance, newName, null);
} catch (Exception x) {
Debug.WriteLine(x.Message);
}
}
break;
}

Loading…
Cancel
Save