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.
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.
Thanks for your response. I've just checked IsVisibleChanged and it looks like when PaneToolWindow is docked by drag and drop this event is fire 3 times. When it is docked by "Tabbed Document" command it is fired only once.
That seems like a bug that we'll need to look into. For now you might want to just asynchronously process it - i.e. do a BeginInvoke and then check the IsVisible state and act based on that.
Hello Anton,
I have logged this behavior wherein the IsVisibilityChanged event is fired more than twice between undocking and docking a pane, in our internal tracking system with a Development ID of 166233. The next step will be for a developer to review the issue and to offer a fix, or other resolution.
I have created a private case, CAS-132785-T5K6J3, to track this issue for you and notify you of any changes in the status.
You may access this case at https://ko.infragistics.com/my-account/support-activity
Please let me know if you have any questions.
Sincerely,
Valerie
Developer Support Supervisor - XAML
Infragistics
www.infragistics.com/support