I'm having the following problem:
1) I dock together two floating panes (one at the top, one at the bottom)
2) I click on the bottom pane: bottom pane is activated, top pane is deactivated
3) I click on a third pane: top and bottom pane are deactivated
4) I click on the top pane: Bottom pane is first activated, then top
pane is activated. Top pane should be activated directly but since it is
docked together with another pane that was previously active, it is somehow not.
It is not a major issue for us but it generates polluting activation and deactivation event.
Is this a normal behavior ? Is there a way to prevent such unwanted pane activation/deactivation events?
You don't indicate where the third pane exists but I assume it is in the main dockmanager or in a different floating one. I think what is happening is that when a WPF Window is being activated it will first focus the last element that it had as focused when it lost focus. In your case that was the bottom pane (or an element in the bottom pane). Since the bottom pane will get a GotKeyboardFocus event, the Activated event will occur. Processing then continues and the original event (mousedown in this case) is routed/processed which results in another pane being activated. Since the ActivePane is tied to the element with keyboard focus I don't see any simple way around this. You could defer your processing of the activepane (e.g. begininvoke) and when the delayed callback is invoked ignore it if it lost focus.
Yes, the third pane exists.
Thank you for your answer. I suspected it was related to WPF but I wanted to be sure.
thanks. I found it.
That solved my problem.