Reputation: 20414
Consider a XAML snippet like this:
<Grid>
<Button x:Name="myButton"/>
<m:MyControl Button="myButton"/>
</Grid>
Of course this doesn't work. But what I need is to pass the Button control instance named "myButton" as value to the other control's Button
property. I've also tried it with {StaticResource myButton}
but it fails telling me that the resource cannot be found.
What's the correct XAML syntax for that?
Upvotes: 1
Views: 450
Reputation: 17083
If MyControl.Button
is a DependencyProperty you can do it so
<m:MyControl Button="{Binding ElementName=myButton}" />
Upvotes: 2