This is a migrated thread and some comments may be shown as answers.

Raddocking does not update viewmodel while loading layout

1 Answer 35 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Bipin
Top achievements
Rank 1
Bipin asked on 05 Aug 2014, 12:50 PM
Hi,
  I am using Raddocking control with Q3 2013 SP released libraries, which supports PanesSource Property. I want to Save/Load layout and content of all opened RadPanes. While loading layout through XamlMainDocker_ElementLoaded event, raddocking control does not update viewmodel binded to PanesSource. Here is my UI, Code behind and viewmodel

<telerik:RadDocking x:Name="XamlMainDocker" PanesSource="{Binding Path=TrendRadPanes, Mode=TwoWay}" ActivePane="{Binding Path=TrendActivePane,Mode=TwoWay}"
                                BorderThickness="0" Padding="0" Background="Transparent" Grid.ColumnSpan="2" Margin="-1,0,1,0"
                                AllowDragReorder="True" AllowUnsafeMode="True" Grid.Column="0" ElementLoaded="XamlMainDocker_ElementLoaded" >
<telerik:RadDocking.DockingPanesFactory>
                    <telerik:DockingPanesFactory/>
                </telerik:RadDocking.DockingPanesFactory>
            </telerik:RadDocking>

TrendRadPanes is my ObservableCollection<RadPane>. The application allows user to add radpane at runtime.
While adding radpan into the TrendsRadpanes collection I am serializing the Radpane in viewmodel as below.

                RadPane pane1 = new RadPane();
                pane1.Header = TabName;
                RadPaneUserControl userControl = new RadPaneUserControl(newTrendTab.TabName);
                pane1.Content = userControl;
                RadDocking.SetSerializationTag(pane1, newTrendTab.TabName);
               TrendRadPanes.Add(pane1);

While saving the layout, I am storing Layout and content of Radpane separately into the database. Here is how I am storing layout as a string.

            MemoryStream stream = new MemoryStream();
            docking.SaveLayout(stream);
            stream.Seek(0, SeekOrigin.Begin);
            StreamReader reader = new StreamReader(stream);


Load Layout -
                    using (Stream stream = new MemoryStream(Encoding.UTF8.GetBytes(userSession._layout)))
                    {
                        stream.Seek(0, SeekOrigin.Begin);
                        XamlMainDocker.LoadLayout(stream);
                    }


As raddocking.SaveLayout does not save content of RadPane, I am using ElementLoaded event to load the content at runtime.

        private void XamlMainDocker_ElementLoaded(object sender, LayoutSerializationEventArgs e)
        {
            RadPane pane = e.AffectedElement as RadPane;
            if (pane != null)
            {
                AnalyzeTrendsViewModel analyzeVM = LayoutRootAnalyzeTrends.DataContext as AnalyzeTrendsViewModel;
                pane.Content = analyzeVM.LoadRadPaneUserControl(pane.Header.ToString());
            }
        }
But it does not update the PanesSource Collection. Please help me to solve my issue. Am I missing something?

Thanks
Bipin
           

1 Answer, 1 is accepted

Sort by
0
Vladi
Telerik team
answered on 08 Aug 2014, 08:41 AM
Hello Bipin,

Thank you for contacting us.

You can take a look at our SDK example which demonstrates the use of the PanesSource, DockingPanesFactory and Save/LoadLayout functionality of RadDocking in a more real life scenario. The SDK example could be found in our online repository at GitHub here. You can download the entire repository as a zip file directly from the following link: https://github.com/telerik/xaml-sdk/archive/master.zip. For more details you could also take a look at the blog post related to that example. Hope this is helpful.

Regards,
Vladi
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
Docking
Asked by
Bipin
Top achievements
Rank 1
Answers by
Vladi
Telerik team
Share this question
or