Hi,
I just ran into a problem I (or a tester) should have noticed a long time ago.
Let's say I have a usercontrol which contains a dock manager, which contains a number of panes, each with a different usercontrol.
The user controls in the panes are "dumb" - the main usercontrol (the one that owns the dock manager) has routed command bindings, and supplies data for the controls to display. If, for example, the user clicks on a row in a XamDataGrid in a control, it executes a routed command that is defined in the main control. The main control does whatever has to be done, and updates the datacontext of the various panes.
This works as long as all the panes are docked. However, I just noticed that if I undock a pane that hosts a usercontrol that uses a routed command and leave the pane floating, then the routed command never gets executed. This actually makes sense (I think): When a pane is floating, it's no longer part of the element tree of the main usercontrol like it was while docked (I sort of confirmed that with Snoop.)
Any suggestions as to how to handle this kind of interaction without using routed commands? I'm kind of scr***d here!
Thanks,Michel
No - there were other priorities, so I ended up disabling the ability to drag the panes out of the dock manager. I have to get back to this sometime, though I have no idea what approach to use.
I have this exact problem
Did you solve this? If so could you by chance post some code?
OK. I'll have to experiment a bit with this - I'm not sure how the ToolWindow will (1) be able to handle the command and (2) talk to the usercontrol, which is not in the visual tree...
No its not in the same visual tree which is why you're not getting any commands from within it routing to your user control. ToolWindow is a class we have that is used to host "floating" content. In a standard WPF implementation that means they are hosted in a WPF window that contains the ToolWindow and its contents.
Hmmm... Is the ToolWindow in the same visual tree as the "main" usercontrol though? I actually haven't dealt with that class yet.