Hi,
I'm using XamDockManager to show/hide several windows. I received an error when hiding a window but only in a particular sequence. I attached a simplified sample to show the problem. The sequence to replicate the error is as following:
1. After application starts, click "Hide" button, this should hide window "Hidable Panel".
2. click Application tab on top, this should hide "First Panel" and display "Second panel"
3. click "Show" button, this will show "Hidable Panel" but it's not visible because it is behind "Second Panel".
4. Drag "Second Panel" away to expose "Hidable panel" and dock it side by side with "Second Panel"
5. Click "Hide" button, an error is generated
I need to first solve the error, then need to know at step 3, how to dock "Hidable Panel" side by side with "Second Panel"
Your help is greatly appreciated.
Hello,
I am checking if this is still an issue for you.
If you require any further assistance please do not hesitate to ask.
Hi Yanko,
I'm so sorry for the delay. I've been distracted from this project totally.
I was tring both of your sample projects, but they are not exactly the same as my scenario, mainly because the button in my sample can hide and also show the Hidable panel. But I think the second sample is more closer. I did get an error from scenario_2 from following steps:
drag "Second Panel" to dock it side by side with "First Panel"
Click "button"
Error came out says "Eleement is already the child of another element"
But this error is different than the error I recieved from my sample.
Thank you very much!
I simplyfied my sample app and use just 2 buttons to display the panels. Hopefuly this will help you replicate the error. This is how to reproduce the error.
2. click Application button on top, this should hide "First Panel" and display "Second panel"
4. Drag "Second Panel" away to expose "Hidable panel" and dock "Hidable panel" side by side with "Second Panel"
Thank you!
Hi Bing,
Thank you for your feedback. Is it possible to zip the sample application again because it seems that for some reasons the attached zip file is corrupted ?
Looking forward to hearing from you.
Sure. I recreated the zip file.
Thanks,
Bing
Thank for the attach sample application. I have been looking into it and I am not bale to reproduce the exception. Could you attach a screenshot of the location of the panes after step 4 and before press the hide button in step 5. I have been trying multiple scenarios but no error appears.
Sure, attached 3 screen shots. Thanks for your time.
A call to "UpdateLayout" after visibility changed seemed to resoved my issue. I also removed the code to set IsFloating, IsMaximized and these seem to make code more predictable and stable.
Thanks a lot for your help!
Hello Bing,
I have received a response from our development team and it seems that this is not a development issue. The XamDockManager does some deferred processing of the visibility change because it doesn't know what other changes might happen. It does so in response to the UpdateLayout of the PaneBase. In your scenario the "Hidable" pane and the "Second Panel" are in the same panel. First you change the visibility of the "Hidable" pane to Collapsed. That starts a deferred processing of that change. Then you immediately changes the IsFloating of the "Second Panel". At the time you make that call it is still parented within a split pane within the "Hidable" pane but in the process of responding to the IsFloating change a call to UpdateLayout is made. When that happens the deferred processing of the Visibility change occurs and the "Second Panel" is attempted to be made floating but it is still within that SplitPanel. While it might be possible for us to force that pending processing as part of the IsFloating change or possibly ignore the synchronization while the IsFloating is being done, both of those could introduce a new issue. Since you control the change you can skip the undesired behavior by calling the ‘UpdateLayout’ method after changing the Visibillty of the "Hidable" pane to Collapsed like e.g. :
if (name == "SecondPanelTab")
{
contentPaneFirst.Visibility = System.Windows.Visibility.Collapsed;
contentPaneSecond.Visibility = System.Windows.Visibility.Visible;
if (show.IsChecked == true)
contentPaneSecond.IsFloating = false;
}
else
contentPaneHidable.Visibility = System.Windows.Visibility.Collapsed;
// make sure the deferred processing of the visibility change are completed
contentPaneHidable.UpdateLayout();
contentPaneSecond.IsFloating = true;
contentPaneSecond.IsMaximized = true;
return;
Let me know, if you need any further assistance on this matter.
I have logged this behavior with our developers in our tracking system, with an issue ID of 132184. I have also created a support ticket on your behalf with number CAS-108836-Y5H1C0 in order to link the development issue to it so that you are automatically updated when a Service Release containing your fix is available for download.