I am confused about the GotFocus handling, setting a lastSelectedPane etc. I do not know the purpose of the code. It does not seem suited to lazy initialization or to adding context menu items to the last selected pane.
As I see it, the issues are:
1. How to determine if a RadPane is visible to the user (selected pane in group, not auto hidden)
2. How to get notified when a RadPane becomes visible to the user (selected pane/tab in group, auto un-hide)
It seems to me the answers are:
1. If ((IsHidden) || (!IsSelected)) then the pane is not visible to the user. Otherwise, it is.
Exception: The pane may be covered by a floating pane or an auto show of a pane (mouse over tab when auto hide) and it would still be considered visible to the user. I do not think this is state that matters much.
2. Override OnIsSelectedChanged and call a custom event.
public class MyRadPane : RadPane
PaneShownEventDelegate(RadPane sender, EventArgs e);
// Subscribe to the event somewhere
//Handle the event
myRadPane_PaneShown(RadPane sender, EventArgs e)
This seems to work correctly.
The GotFocus approach does not seem to work when a pane is shown from auto hide. The pane does not get focus in that instance. GotFocus is also called multiple times (like when switching between programs).
Is there something wrong with this approach?