(Please take each of controls stated below as control created using MVVM pattern)
So, I have a UserControl
which I place on my MainWindow
. I want my UserControl
, if clicked (in the MainWindow
, inside the UserControl
), the background changed into another color, and if I click in the MainWindow
, but outside of UserControl
, then the UserControl
's background will change to the original color.
What I've tried :
- I've tried to apply a Command inside the
UserControl.InputBindings
which to detect Mouse Input (MouseBinding
), but the onlyMouseBinding
raised is theMouseBinding
in theWindow.InputBindings
(which should be raised ONLY when the click input is outside theUserControl
), but apparently, wherever a click happen, the onlyMouseBinding
raised is only the one inWindow.InputBindings
. - Differ the
CommandParameter
betweenMouseBinding
inWindow.InputBindings
andUserControl.InputBindings
.
Question :
- How to differ the
MouseBinding
between clicking inside theUserControl
and outside?
Thanks