how can I pass the window I am currently on as a parameter to a command?
I like to do this in XAML-markup:
<Button Command="CommandGetsCalled" CommandParameter="-this?-" />
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.
There are two ways I can of think to do this: Give the window a name (via a
x:Nameattribute on theWindowtag, and then construct a binding like this (assumes the name of the window is ‘ThisWindow’):For something more general (doesn’t rely on giving the current Window a name), the binding can be constructed like this: