passing the current Window as a CommandParameter

后端 未结 3 883
忘了有多久
忘了有多久 2020-12-29 03:50

how can I pass the window I am currently on as a parameter to a command?

I like to do this in XAML-markup:

3条回答
  •  天涯浪人
    2020-12-29 04:19

    There are two ways I can of think to do this: Give the window a name (via a x:Name attribute on the Window tag, 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:

提交回复
热议问题