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

Docking custom property provider is not working

4 Answers 139 Views
PersistenceFramework
This is a migrated thread and some comments may be shown as answers.
Prabakaran
Top achievements
Rank 1
Prabakaran asked on 09 Nov 2015, 03:47 AM

Dear Team,

I am using the docking custom property provider to save the state of my layout. When i reload the layout i can able to load the three different radpane in the specified position but data is not loading. please help to check and advise on this issue.

<Grid>
       <Grid Opacity="{Binding MainGridOpacity}">   
           <telerik:RadDocking x:Name="radDocking"
                               HasDocumentHost="False">
               <telerik:RadDocking.DocumentHost>
               <telerik:RadSplitContainer ScrollViewer.VerticalScrollBarVisibility="Auto">
                   <telerik:RadSplitContainer Orientation="Vertical" telerik:ProportionalStackPanel.RelativeSize="70, 100">
                       <telerik:RadPaneGroup>
                           <telerik:RadPane x:Name="radPane1"
                                            Header="Dashboard"
                                            telerik:RadDocking.SerializationTag="radPane1">
                               <Grid>
                                   <Grid.RowDefinitions>
                                       <RowDefinition Height="Auto" />
                                       <RowDefinition Height="Auto" />
                                       <RowDefinition Height="Auto" />
                                   </Grid.RowDefinitions>
                                   <StackPanel>
                                       <telerik:RadTabControl Width="Auto"
                                                              VerticalAlignment="Stretch"
                                                              x:Name="radDashboardTabControl">
                                       </telerik:RadTabControl>
                                   </StackPanel>
                               </Grid>
                           </telerik:RadPane>
                       </telerik:RadPaneGroup>
                   </telerik:RadSplitContainer>
                   <telerik:RadSplitContainer Orientation="Vertical"
                                              InitialPosition="DockedRight"
                                              telerik:ProportionalStackPanel.RelativeSize="30, 100">
                       <telerik:RadSplitContainer Orientation="Horizontal">
                           <telerik:RadPaneGroup telerik:ProportionalStackPanel.RelativeSize="50, 50">
                               <telerik:RadPane Header="ApplicationInfo"
                                                telerik:RadDocking.SerializationTag="ApplicationInfo">
                                   <!--<ScrollViewer VerticalScrollBarVisibility="Auto">-->
                                       <StackPanel>
                                           <TextBlock Text="{Binding AppNo}" />
                                           <ContentControl x:Name="appInfoControl" />
                                       </StackPanel>
                                   <!--</ScrollViewer>-->
                               </telerik:RadPane>
                           </telerik:RadPaneGroup>
                       </telerik:RadSplitContainer>
                       <telerik:RadSplitContainer Orientation="Horizontal">
                           <telerik:RadPaneGroup x:Name="radPaneGroup1" telerik:ProportionalStackPanel.RelativeSize="50, 50">
                               <telerik:RadPane x:Name="radPane11"
                                                Header="WorkLoad"
                                                telerik:RadDocking.SerializationTag="radPane11">
                                   <ScrollViewer Visibility="Visible"
                                                 HorizontalScrollBarVisibility="Visible">
                                       <ContentControl x:Name="workLoadControl" />
                                   </ScrollViewer>
                               </telerik:RadPane>
                           </telerik:RadPaneGroup>
                       </telerik:RadSplitContainer>
                   </telerik:RadSplitContainer>
               </telerik:RadSplitContainer>
               </telerik:RadDocking.DocumentHost>
           </telerik:RadDocking>
       </Grid>
       <Grid>   
           <StackPanel Margin="3">
               <telerik:RadButton Margin="0 2" Width="200"
                                  Content="Save Layout"
                                  Click="OnSave"
                                  x:Name="buttonSave" />
               <telerik:RadButton Margin="0 2"
                                  Width="200"
                                  Content="Load Layout"
                                  Click="OnLoad"
                                  x:Name="buttonLoad" />
           </StackPanel>
       </Grid>
   </Grid>
DashboardGridView.XMAL.cs

public partial class DashboardGridView : UserControl
    {
 System.IO.Stream stream;
        public DashboardGridView()
        {
ServiceProvider.RegisterPersistenceProvider<ICustomPropertyProvider>(typeof(Telerik.Windows.Controls.RadDocking), new DockingCustomPropertyProvider());
}
 private void OnSave(object sender, System.Windows.RoutedEventArgs e)
        {
            PersistenceManager manager = new PersistenceManager();
            this.stream = manager.Save(this.radDocking);
            this.EnsureLoadState();
            using (FileStream file = new FileStream(@"C:\temp\file.bin", FileMode.Create, System.IO.FileAccess.Write))
            {
                byte[] bytes = new byte[stream.Length];
                stream.Read(bytes, 0, (int)stream.Length);
                file.Write(bytes, 0, bytes.Length);
                stream.Close();
            }
        }
 
        private void OnLoad(object sender, System.Windows.RoutedEventArgs e)
        {
            using (stream = new MemoryStream())
            {
                using (FileStream file = new FileStream(@"C:\temp\file.bin", FileMode.Open, FileAccess.Read))
                {
                    byte[] bytes = new byte[file.Length];
                    file.Read(bytes, 0, (int)file.Length);
                    stream.Write(bytes, 0, (int)file.Length);
                }
                this.stream.Position = 0L;
                PersistenceManager manager = new PersistenceManager();
                manager.Load(this.radDocking, this.stream);
                this.EnsureLoadState();
            }
        }
        private bool CanLoad()
        {
            return this.stream != null && this.stream.Length > 0;
        }
 
        private void EnsureLoadState()
        {
            this.buttonLoad.IsEnabled = this.CanLoad();
        }
}

4 Answers, 1 is accepted

Sort by
0
Prabakaran
Top achievements
Rank 1
answered on 09 Nov 2015, 03:51 AM
Added screenshot of the layout page.
0
Martin Ivanov
Telerik team
answered on 11 Nov 2015, 06:03 PM
Hello Prabakaran,

I will need some time to check on your case and I will contact you as soon as I have more information on the matter.

Regards,
Martin
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Prabakaran
Top achievements
Rank 1
answered on 12 Nov 2015, 01:25 AM

Dear Martin,

Thanks for your reply. please help to update ASAP once you get update as we need this implementation to be done sooner since we need to move this changes to production.

Thank you.

Regards,

Prabakaran

0
Martin Ivanov
Telerik team
answered on 16 Nov 2015, 03:21 PM
Hello Prabakaran,

Note that RadDocking has a built-in mechanism for saving its layout which you can use instead of PersistenceFramework. However, keep in mind that this mechanism (neither the persistence framework) cannot save automatically the content of the panes. It only remembers the current UI state (the set properties) of the panes, groups and split containers. In order to save the content of the panes you can handle the ElementLoaded event of RadDocking and set the content of the newly created pane manually. You can see how to do that in the Save/Load the Content of the Panes help article.

Regards,
Martin
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
PersistenceFramework
Asked by
Prabakaran
Top achievements
Rank 1
Answers by
Prabakaran
Top achievements
Rank 1
Martin Ivanov
Telerik team
Share this question
or