Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
590
ToolWindowLoaded event fired only for the first time
posted

Hi.

I see a strange behavior of XamDockManager - when you undock tab by clicking "Dockable" in the context menu for tab header then ToolWindowLoaded event is fired only for the first time. But when you'll undockk by using drag and drop functionality then this event is fired each time tab is undocked. The same goes for PaneToolWindowClosing event.

I've created sample project. Pay attention on counters in the status bar. First dock/undock tab by using "Dockable"/"Tabbed Document" menu items several times. Then do the same by using drag and drop.

PaneToolWindowExpansionSample.ZIP
Parents
  • 54937
    Offline posted

    Yes that is the expected and intended behavior and is documented in the help. The ToolWindowLoaded event fires when a given PaneToolWindow instance is shown for the first time. When the user drags a pane a new PaneToolWindow is always created. When someone double clicks the pane header or pane tab item they are toggling between the floating dockable position and the docked dockable position restoring it to where it was before. When that happens the previous PaneToolWindow is displayed (assuming it’s not already showing – remember you can have multiple panes in a floating window and just toggle the docked state of one) and the ToolWindowLoaded event is not invoked. It would only be invoked if the pane was never previously in a floating state and we need to create a new PaneToolWindow to host it. That event is akin to the Loaded event (hence the naming) and is not meant to be indicative of the visible state of the toolwindow but simply a way to know when a PaneToolWindow is first initialized (so one might do some manipulation of it) and ToolWindowUnloaded is when it is being released (so one might undo that manipulation if necessary). The WPF framework has a IsVisibleChanged event defined on UIElement so if they really wanted to know when the PaneToolWindow is being made visible then perhaps they could hook the ToolWindowLoaded and in that event hook the IsVisibleChanged of the e.ToolWindow.

Reply Children