I tried switching layout in the ActivePaneChanged event, but this throws an InvalidOperationException. Please help!
private void dockingPaneManager_ActivePaneChanged(object sender,
Telerik.Windows.Controls.Docking.ActivePangeChangedEventArgs e)
{
if (e.NewPane == pane1)
LoadLayout(Properties.Resources.Pane1);
else if (e.NewPane == pane2)
LoadLayout(Properties.Resources.Pane2);
else if (e.NewPane == pane3)
LoadLayout(Properties.Resources.Pane3);
}
<telerik:RadDocking x:Name="dockingPaneManager" ActivePaneChanged="dockingPaneManager_ActivePaneChanged">
<telerik:RadDocking.DocumentHost>
<telerik:RadSplitContainer>
<telerik:RadPaneGroup>
<telerik:RadDocumentPane x:Name="pane1" Title="1st" telerik:RadDocking.SerializationTag="Pane1">
<telerik:RadDocumentPane.Content>
... some content ...
</telerik:RadDocumentPane.Content>
</telerik:RadDocumentPane>
<telerik:RadDocumentPane x:Name="pane2" Title="2nd" telerik:RadDocking.SerializationTag="Pane2">
<telerik:RadDocumentPane.Content>
... some content ...
</telerik:RadDocumentPane.Content>
</telerik:RadDocumentPane>
<telerik:RadDocumentPane x:Name="pane3" Title="3rd" telerik:RadDocking.SerializationTag="Pane3">
<telerik:RadDocumentPane.Content>
... some content ...
</telerik:RadDocumentPane.Content>
</telerik:RadDocumentPane>
</telerik:RadPaneGroup>
</telerik:RadSplitContainer>
</telerik:RadDocking.DocumentHost>
This is the thrown exception:
---------------------------
---------------------------
System.InvalidOperationException: The specified Visual is not an ancestor of this Visual.
at System.Windows.Media.Visual.TrySimpleTransformToAncestor(Visual ancestor, Boolean inverse, GeneralTransform& generalTransform, Matrix& simpleTransform)
at System.Windows.Media.Visual.InternalTransformToAncestor(Visual ancestor, Boolean inverse)
at Telerik.Windows.Controls.ApplicationHelper.TransformToScreenRoot(UIElement target) in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Core\Controls\Common\ApplicationHelper.cs:line 285
at Telerik.Windows.Controls.RadPane.GetDraggableArea(Boolean allowDragReorder) in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Controls\Docking\Docking\Docking\RadPane.cs:line 1378
at Telerik.Windows.Controls.RadPane.OnHeaderMouseLeftButtonDown(Object sender, MouseButtonEventArgs e) in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Controls\Docking\Docking\Docking\RadPane.cs:line 886
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
---------------------------
OK
---------------------------