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 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.