Issue with RadPane content Freezing After Resetting Layout on Floating State

2 Answers 26 Views
Docking
Ohad
Top achievements
Rank 3
Bronze
Iron
Iron
Ohad asked on 14 Mar 2024, 09:15 AM | edited on 14 Mar 2024, 09:19 AM

My application utilizes the RadDocking control to manage layout, including a RadPane that hosts a CefSharp browser. I've observed that when this pane is docked and I reset the layout, everything functions as expected - the layout resets and the browser remains responsive. However, if I float the pane (detach it so it becomes a window) and then reset the layout, the browser within the pane freezes and becomes unresponsive.

Here's a simplified snippet of how the RadPane and browser are set up:

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition Height="0.2*"/>
        </Grid.RowDefinitions>
        <telerik:RadDocking x:Name="radDocking" HasDocumentHost="False" SerializationTag="Docking">
            <telerik:RadSplitContainer telerik:RadDocking.SerializationTag="S1">
                <telerik:RadPaneGroup x:Name="RadPaneGroup1" telerik:RadDocking.SerializationTag="G1">
                    <telerik:RadPane x:Name="RadPane1" telerik:RadDocking.SerializationTag="P1">
                        <TextBlock Text="Pane 1"/>
                    </telerik:RadPane>
                </telerik:RadPaneGroup>
            </telerik:RadSplitContainer>
            <telerik:RadSplitContainer telerik:RadDocking.SerializationTag="S2">
                <telerik:RadPaneGroup x:Name="RadPaneGroup2" telerik:RadDocking.SerializationTag="G2">
                    <telerik:RadPane x:Name="RadPane2" telerik:RadDocking.SerializationTag="P2">
                        <wpf:ChromiumWebBrowser Name="Browser" Initialized="Browser_OnInitialized"/>
                    </telerik:RadPane>
                </telerik:RadPaneGroup>
            </telerik:RadSplitContainer>
        </telerik:RadDocking>
        <Button Grid.Row="1" Content="Reset Layout" Click="ResetLayout_Click"/>
    </Grid>

 public partial class MainWindow
 {
     public MainWindow()
     {
         InitializeComponent();
         SaveLayout();
     }
     
     private void Browser_OnInitialized(object sender, EventArgs e)
     {
         string videoUrl = "https://www.youtube.com/embed/JrNMyzsYr4M?autoplay=1&mute=1";

         string html = $@"
         <html>
             <head>
                 <meta charset='utf-8'>
             </head>
             <body style='margin:0; padding:0;'>
                 <iframe width='100%' height='100%' src='{videoUrl}' frameborder='0' allow='autoplay; encrypted-media' allowfullscreen></iframe>
             </body>
         </html>
         ";

         Browser.LoadHtml(html, "http://dummy.com");
     }

     private void SaveLayout()
     {
         using (IsolatedStorageFile storage = IsolatedStorageFile.GetUserStoreForAssembly())
         {
             using (var isoStream = storage.OpenFile("RadDocking_Layout.xml", FileMode.Create))
             {
                 radDocking.SaveLayout(isoStream);
                 isoStream.Seek(0, SeekOrigin.Begin);
                 StreamReader reader = new StreamReader(isoStream);
                 reader.ReadToEnd();
             }
         }
     }

     private void ResetLayout_Click(object sender, RoutedEventArgs e)
     {
         using (IsolatedStorageFile storage = IsolatedStorageFile.GetUserStoreForAssembly())
         {
             using (var isoStream = storage.OpenFile("RadDocking_Layout.xml", FileMode.Open))
             {
                 radDocking.LoadLayout(isoStream);
             }
         }
     }
 }

 

The primary question I have is: Why does the browser freeze only when the pane is floating and I reset the layout, and how can I prevent this without resorting to programmatically docking the pane before the reset?

 

Thanks.

2 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 18 Mar 2024, 11:26 AM

Hi Ohad,

RadDocking cannot save the content of the panes and you must restore it manually. Detailed information is available here: WPF Docking - Save/Load the Content of the Panes.

I have attached a small sample project that shows this as well. In addition, It would be better to use the Loaded event to save the initial layout. 

I hope this helps. Should you have any other questions do not hesitate to ask.

Regards,
Dimitar
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

0
Ohad
Top achievements
Rank 3
Bronze
Iron
Iron
answered on 21 Mar 2024, 01:45 PM | edited on 21 Mar 2024, 01:46 PM

By setting IsSelected="True", you'll notice that the Pane no longer freezes.

<telerik:RadPane x:Name="RadPane2" telerik:RadDocking.SerializationTag="P2" IsSelected="True">

Tags
Docking
Asked by
Ohad
Top achievements
Rank 3
Bronze
Iron
Iron
Answers by
Dimitar
Telerik team
Ohad
Top achievements
Rank 3
Bronze
Iron
Iron
Share this question
or