Reloading layout fails
See original GitHub issueHi
This is an old fix i wrote for v2.4 back in 2008. The problem is that when you reload a saved layout, the docking content remains in a inconsistent state. I wrote & added the following code to DockContentCollection.cs to prevent this and allow a smooth reload of saved layouts. All you need to do is to call RemoveAll() before reloading the layout. I also added a public version of the RemoveContent method (doing the extra cleanup) I felt it was missing.
//veg: 22-12-2008 - Added method to remove all IDockingContent.
// Call before reloading layout.!
//veg: 01-20-2009 - Reordered code to prevent problems with DockState.
public void RemoveAll()
{
for (int i = Count; i != 0; i--)
{
RemoveContent(this[i - 1]);
}
}
//veg: 22-12-2008 - Added Public version of Remove() with some additional cleanup!
public void RemoveContent(IDockContent content)
{
if (content == null)
throw new InvalidOperationException();
Remove(content);
((DockContent)content).DockState = DockState.Unknown;
((DockContent)content).FloatPane = null;
((DockContent)content).DockPanel = null;
((DockContent)content).Pane = null;
}
I will have a look asap at the new 2.7.x code and compare code but sofar this isue does not seem to be solved.
Issue Analytics
- State:
- Created 11 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Failed to load window layout error
Failed to load window layout error · 1. In the projects Library folder there is a file "CurrentLayout-default.dwlt" · 2. Go into USER/Library/ ......
Read more >'Failed to load window layout' Error - How to fix in Unity 3D
In Unity 3D “Failed to load window layout” error is showing when there are any errors in your Editor script. “This happens if...
Read more >Can not start a new project as unity has "failed to load ...
Quit Unity and do the following: Go to "AppData\Roaming\Unity\Editor-5.x\Preferences\Layouts\default" or ...
Read more >Anyone else get Relativity Forms failed to load layout error?
When clicking into a document in the viewer, the coding layout sometimes shows the message Relativity Forms failed to load layout.
Read more >Update flow layout fails because of reload data absent #47
So I change layout to show 7 days and display header by adjusting its height. Before displaying a week I already have some...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi
I think the problem is that there is no simple/obvious counterpart of DockContent.Show(DockPanel) that removes a form from the DockContentCollection. But I found that setting:
DockContent.DockHandler.DockPanel = null;
does indeed remove items from the DockContentCollection and allows a restore of forms from xml.
I must have either overlooked this issue or some code has improved in the meanwhile! It solves the reloading problems.
As for the closing of DockContent decendant Forms, I would expect it to set the DockPanel to null and remove themselves from the readonly collection this way. This might be an
I recoded my code and now just walk the DockPanel.Contents collection and set all DockHandler.DockPanel to null.
This removes all HideOnClose=true forms that where Hidden and All Visible Forms from the DockContentCollection.
Closed Forms with HideOnClose=false are already no longer part of the Collection and Disposed by .NET and are recreated by DeserializeDockContent calls.
So i can now use unmodified code, case closed!
regards
Thanks for sharing the tip. Finding out such workaround is never an easy task, so you did contribute something really valuable.