I assigned x:Name in my XAML-file to a object which can trigger a MouseDown-event.
In that event I’d like to get the x:name-attribute of the sender again.
How do I do that?
The object looks like that:
<ModelUIElement3D MouseDown="ModelUIElement3D_MouseDown" x:Name="trololo">
If I have understood your question correctly, you can access the
Nameproperty by casting the sender to aFrameworkElement.Alternatively you can just use the reference object that is created by the designer, the instance name is the same as the name that you specify in the
x:Nameattribute.The following demonstrates both options.