I have a window that is databound to a ViewModel. The ViewModel has many properties, some of which are expensive to evaluate and are not always needed by the user.
What I would like to do is have these properties databound to controls contained in different unexpanded expanders. When the expander is expanded by the user I would like the controls to bind and the properties to be evaluated. If the user does not expand the expander, the properties should not be evaluated, and the cost not incurred.
I could certainly do this using events from the expander but I’m trying to find a nice MVVM way of doing it. Any suggestions?
Would something like this work?
If you just want the expanded binding to be the datacontext of the parent window, then presumably this would work in the trigger: