My control has a property that returns an ICommand object. Using XAML, how to I bind a button to it?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Without knowing anything about the relation of the two I would use element binding. E.g.
You should think about the approach that a control provides a command. It’s seems to me some kind of weird. 😉
Regards
EDIT
Ah ok, it was just a hint. Just in case you didn’t think about it.
Here is another way to bind your command. I’ve to admit that I didn’t test it. But I think the following should work too.
When the
Buttonis in the control you could also use relative binding.Then you don’t need a name for the control. I’m avoiding names when ever I can to prevent dirty workarounds in code behind.
Yes, I know it some kind of paranoid. 😉