Welcome Guest Search | Active Topics | Sign In | Register

DockView - Don't show a saved layout correctly - WPF & C# Options
Stefan Eriksson
Posted: Monday, May 26, 2014 7:25:20 AM
Rank: Newbie
Groups: Member

Joined: 5/26/2014
Posts: 2
Hi!

I'm evaluating the DockView control and have problem loading a saved layout.

1) I run my application and save the layout immediately with the DockContainer.SaveLayout() method to a local string.
2) I then fool around with the DockViews and relocate them to different locations.
3) Then I want to reload to the same layout as I had when the application started. So I call the DockContainer.LoadLayoutXml() method with the local string as parameter.

The result is not what I wanted. Instead the DockContainer.Views collection only contains two Views.

Apparently this seem not to be the way to do this. Even if the instructions clearly describe this as a piece of cake at http://www.essentialobjects.com/doc/5/dockview/overview.aspx -> EO.Wpf 2013.02 -> EO.Wpf DockView -> Saving/loading layout.

How shall I solve this? I simply need a reset functionality to restore the layout of the docking views when needed.

Best regards,
/Steffe

I include my XAML code.

Code: XML
<Window x:Class="WpfApplication1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"  
        xmlns:eo="http://schemas.essentialobjects.com/wpf/"
        Title="MainWindow" Height="800" Width="1200">

    <eo:DockContainer Name="eoDockContainer">
        
        <!-- Tree, file info and summery views -->
        <eo:DockView Dock="Left" Width="200" Name="eoLeft">
            <eo:DockView.ChildViews>
                
                <!-- TreeView -->
                <eo:DockView Dock="Top" Height="500">
                    <eo:DockItem Name="eoTreeView" Title="TreeView" />
                </eo:DockView>
                
                <eo:DockView Dock="Bottom">
                    <eo:DockView.ChildViews>

                        <!-- FileView -->
                        <eo:DockView Dock="Top" Height="150">
                            <eo:DockItem Name="eoFileInfoView" Title="FileInfoView" />
                        </eo:DockView>
                        
                        <!-- SummeryView -->
                        <eo:DockView Dock="Bottom" Height="150">
                            <eo:DockItem Name="eoSummeryView" Title="SummeryView" />
                        </eo:DockView>
                    </eo:DockView.ChildViews>
                </eo:DockView>

            </eo:DockView.ChildViews>
        </eo:DockView>

        <!-- List, properties and basic properties view  -->
        <eo:DockView Dock="Right">
            <eo:DockView.ChildViews>
                
                <!-- List and basic properties view -->
                <eo:DockView Dock="Left">
                    <eo:DockView.ChildViews>
                    
                        <!-- ListView -->
                        <eo:DockView Dock="Top">
                            <eo:DockItem Name="eoListView" Title="ListView">
                                <StackPanel Orientation="Vertical">
                                    <Button Click="Button_Click_1" Content="Load" Height="100" Width="100" />
                                    <Button Click="Button_Click_2" Content="Save" Height="100" Width="100" />
                                </StackPanel>
                            </eo:DockItem>
                        </eo:DockView>
                    
                        <!-- BasicPropertiesView-->
                        <eo:DockView Dock="Bottom" Height="200">
                            <eo:DockItem Name="eoBasicPropertiesView" Title="BasicPropertiesView" />
                        </eo:DockView>
                        
                    </eo:DockView.ChildViews>
                </eo:DockView>
                
                <!-- Properties view -->
                <eo:DockView Dock="Right" Width="300">
                    <eo:DockItem Name="eoPropertiesView" Title="PropertiesView" />
                </eo:DockView>

            </eo:DockView.ChildViews>
        </eo:DockView>

    </eo:DockContainer>
</Window>
eo_support
Posted: Monday, May 26, 2014 4:07:52 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,196
Hi,

This appears to be a bug. We will look into it and get back to you as soon as possible.

Thanks!
eo_support
Posted: Sunday, June 1, 2014 12:39:35 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,196
Hi,

We have posted a new build that should fix this problem. You can download the new build from our download page.

Thanks!
Stefan Eriksson
Posted: Thursday, June 12, 2014 8:36:37 AM
Rank: Newbie
Groups: Member

Joined: 5/26/2014
Posts: 2
Thank you for solving that issue! One more question:

I have a UserControl located in one of the DockItems.Content property.
The UserControl show a bunch of buttons and other stuff. I can the content when I start my application.
When I load the saved layout the content is removed from the DockItem. By removed I mean the UserControl and it's content is not visable. I checked the DockItem.Content property after I load the layout and the DockItem.Content contains the very UserControl I specified.

Do I miss something or is this another bug?

Best regards,
/Steffe
eo_support
Posted: Thursday, June 12, 2014 9:31:28 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,196
Hi,

LoadLayout only loads DockView's and DockItems. It does not automatically save or load anything inside your DockItem or re-create your UserControl for you because it has no idea what information about your UserControl should be saved and how to restore those information into your UserControl. Instead the DockView only provide support for saving additional state data, you can then write code to save whatever that is important to your UserControl, and then when the item has been recreated, your code would rec-create the UserControl and restore its state based on the data you previously saved. You can find more information on how to save/load custom state data here:

http://www.essentialobjects.com/doc/5/controls/dockview/save_layout.aspx

It is also possible for you to create custom dock item type by deriving from EO.Wpf.DockItem. If you use that approach, then you must also handle DockItemNeeded event and create a DockItem of your custom type inside your event handler. See here for more details:

http://www.essentialobjects.com/doc/5/controls/dockview/activate_item.aspx

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.