Hello,
I'm facing strange behavior after restoring layout by calling DockLayoutManager.RestoreLayout from xml. Please open attached sample app.
-
Run the application and close it by clicking on [X] button so that "layout.xml" file is created in bin folder
-
Uncomment "#region STEP 2" part in MainWindow.xaml and run the application (it is important that application loads layout of state from #1)
2.1. Click once on "Attach panel" --> despite the fact code has docked the panel, it is not present in LayoutTree, see Output window
2.2. Click again on "Attach panel" --> now panel is added to layout correctly, WHY NOW? but IS NOT VISIBLE, see Output Window
2.3. Toggle "IsClosedInViewModel" --> it has no effect, despite the fact binding is established correctly and is present on Closed property --> Panel is never visible
2.4. Stop the application by killing it from VS, so that layout is now not saved -
Uncomment "#region STEP 3" part in MainWindow.xaml and run the application (it is important that app loads layout of state from #1)
3.1. Click on "Attach panel" button --> again Panel is not added, see Output
3.2. Click on "Attach panel" button --> Panel is now added to layout (see output) and IS VISIBLE
3.3. Toggle "IsClosedInViewModel" --> Panel now shows and hides as expected
2.5. Delete "layout.xml" file and comment back "#region STEP 3" so that you get MainWindow.xaml back to state #2 and run the application
2.6. Click twice on "Attach panel" --> Panel is attached
2.7. Toggle "IsClosedInViewModel" --> now it works as expected
Thus from my observations, I assume that if LayoutGroup is empty at the moment when docking to layout, it somehow switches to invisible mode and stays invisible even after adding some content later. Am I right? If so, how can I avoid it?
As you can see from 2.7. if there is no layout restored, then everything works ok, that's why I suspects it has something to do with restoration.
Thanks
Kind regards
Filip<
Hi Filip,
Thank you for your sample project and detailed description. I have reproduced this issue and passed this ticket to our developers for further research. We will update this thread as soon as we make any progress.
Thanks,
Alexander