xceedsoftware / wpftoolkit

All the controls missing in WPF. Over 1 million downloads.
Other
3.89k stars 877 forks source link

AvalonDock and XamlWriter.Save: stack overflow exception #923

Open xceedsoftware opened 7 years ago

xceedsoftware commented 7 years ago

FabioMarcone[CodePlex]
Hi all, I tried to save my dock manager and document pane (empty, without other wpf objects) to xaml string but I had no success, I got always stack overflow exception. Why? Is there a reference in layoutdocument object to its parent? Does exist a way to got it?

Thanks in advance, Fabio

xceedsoftware commented 7 years ago

FabioMarcone[CodePlex]
Xaml: xcad:DockingManager x:Name=dockManager AllowMixedOrientation=True BorderBrush=Black BorderThickness=1

    xcad:DockingManager.DocumentHeaderTemplate
        DataTemplate
            StackPanel Orientation=Horizontal
                Image Source={Binding IconSource} Margin=0,0,4,0/
                TextBlock Text={Binding Title} /
            /StackPanel
        /DataTemplate
    /xcad:DockingManager.DocumentHeaderTemplate
    xcad:LayoutRoot x:Name=_layoutRoot
        xcad:LayoutPanel Orientation=Horizontal
            xcad:LayoutAnchorablePane x:Name=AnchorablePane  DockWidth=2* DockMinWidth=250
                !--xcad:LayoutAnchorable ContentId=properties Title=Properties CanHide=False CanClose=False
                                    AutoHideWidth=240

                    xctk:PropertyGrid NameColumnWidth=110
                SelectedObject={Binding ElementName=_layoutRoot, Path=LastFocusedDocument.Content}/
                /xcad:LayoutAnchorable--
                xcad:LayoutAnchorable ContentId=tools Title=Tools CanHide=True CanClose=False AutoHideWidth=240
                    StackPanel Orientation=Vertical
                        Button x:Name=btntoolsAddDockWindow Click=btntoolsAddDockWindow_ClickADD DOCK WINDOW/Button
                        Button x:Name=btntoolsAddLeftWindow Click=btntoolsAddLeftWindow_ClickADD LEFT WINDOW/Button
                        Button x:Name=btntoolsAddRightWindow Click=btntoolsAddRightWindow_ClickADD RIGHT WINDOW/Button
                        Button x:Name=btntoolsAddTopWindow Click=btntoolsAddTopWindow_ClickADD TOP WINDOW/Button
                        Button x:Name=btntoolsAddBottomWindow Click=btntoolsAddBottomWindow_ClickADD BOTTOM WINDOW/Button

                    /StackPanel
                /xcad:LayoutAnchorable
            /xcad:LayoutAnchorablePane
            xcad:LayoutDocumentPaneGroup DockWidth=4*
                xcad:LayoutDocumentPane x:Name=DocumentPane
                    !-- Documents here--           

                /xcad:LayoutDocumentPane
            /xcad:LayoutDocumentPaneGroup 
            xcad:LayoutAnchorablePaneGroup DockWidth=2* DockMinWidth=250
                xcad:LayoutAnchorablePane
                    xcad:LayoutAnchorable ContentId=plugins Title={DynamicResource Localization_Plugins} 
                        StackPanel Orientation=Vertical Name=spConfiguredPlugins

                        /StackPanel
                    /xcad:LayoutAnchorable
                    xcad:LayoutAnchorable ContentId=guiobjects Title={DynamicResource Localization_GuiObjects} 
                        StackPanel Orientation=Vertical Name=spAvailableGuiObjects

                        /StackPanel
                    /xcad:LayoutAnchorable
                /xcad:LayoutAnchorablePane
            /xcad:LayoutAnchorablePaneGroup
        /xcad:LayoutPanel

        xcad:LayoutRoot.LeftSide
            xcad:LayoutAnchorSide
                xcad:LayoutAnchorGroup x:Name=AnchorGroupLeft

                /xcad:LayoutAnchorGroup
            /xcad:LayoutAnchorSide
        /xcad:LayoutRoot.LeftSide
        xcad:LayoutRoot.RightSide
            xcad:LayoutAnchorSide
                xcad:LayoutAnchorGroup x:Name=AnchorGroupRight

                /xcad:LayoutAnchorGroup
            /xcad:LayoutAnchorSide
        /xcad:LayoutRoot.RightSide
        xcad:LayoutRoot.TopSide
            xcad:LayoutAnchorSide
                xcad:LayoutAnchorGroup x:Name=AnchorGroupTop

                /xcad:LayoutAnchorGroup
            /xcad:LayoutAnchorSide
        /xcad:LayoutRoot.TopSide
        xcad:LayoutRoot.BottomSide
            xcad:LayoutAnchorSide
                xcad:LayoutAnchorGroup x:Name=AnchorGroupBottom

                /xcad:LayoutAnchorGroup
            /xcad:LayoutAnchorSide
        /xcad:LayoutRoot.BottomSide
    /xcad:LayoutRoot
/xcad:DockingManager

in code behind XamlWriter.Save(dockManager.DocumentPane) raises StackOverflow exception.

Thanks.

xceedsoftware commented 7 years ago

BoucherS[CodePlex]
Hi,

Can you submit a sample so that we can test the exact same scenario ? Thanks.