Issue 1: Docking control
1a. Eyeshot control disappears after dock/undock (Dispose timing)
When using the Eyeshot control inside a Telerik docking control, the Eyeshot control may disappear due to a Dispose call.
This is a timing issue caused by the built-in animation of the ToolWindow. When a pane is docked, the pane animation is triggered and the window's Close event fires at a later stage, at which point the Eyeshot control is disposed.
You can turn the ToolWindow animation off by creating an implicit style that sets the AnimationManager.IsAnimationEnabled attached property to false:
<Style TargetType="telerik:ToolWindow">
<Setter Property="telerik:AnimationManager.IsAnimationEnabled" Value="False"/>
</Style>Another option is to derive from the Eyeshot control, override Dispose, and call the base implementation only when the main window is actually closing.
1b. Undocked pane shows a blank (white) area with ImmediateMode renderers
When the Renderer property is set to OpenGL or Direct3D (ImmediateMode), the Eyeshot control paints directly onto a Win32 child window hosted inside a WindowsFormsHost.
WPF cannot composite a Win32 child window into a top-level WPF Window that has AllowsTransparency = True: this is the well-known WPF "airspace" limitation (MSDN).
By default, Telerik RadDocking hosts a floating pane inside a chromeless ToolWindow that is created with AllowsTransparency = True, WindowStyle = None and a transparent background. As a result, when an Eyeshot control using the OpenGL or Direct3D renderer is undocked, its drawing surface is culled from composition and the floating window appears blank.
The fix is the workaround documented by Telerik themselves in the WinFormsInsideDocking sample: subscribe to RadDocking.ToolWindowCreated and turn AllowsTransparency off on the created window, before it is shown for the first time.
XAML:
<telerik:RadDocking x:Name="docking"
ToolWindowCreated="docking_ToolWindowCreated">
...
</telerik:RadDocking>Code-behind (C#):
using Telerik.Windows.Controls; // RadWindowInteropHelper
using Telerik.Windows.Controls.Docking; // ToolWindow, ElementCreatedEventArgs
private void docking_ToolWindowCreated(object sender, ElementCreatedEventArgs e)
{
var window = (ToolWindow)e.CreatedElement;
RadWindowInteropHelper.SetAllowTransparency(window, false);
}AllowsTransparency is a CLR property on Window and cannot be changed after the window is shown, so it must be set from the ToolWindowCreated event (which fires before the window is displayed). With this change, the floating window is created as a normal opaque WPF window and the ImmediateMode scene is composited correctly.
Alternative: if the application cannot customise the floating window (for example because it uses a third-party docking framework), switch the Eyeshot Renderer to Native (WPF). The Native renderer paints via D3DImage inside the WPF render tree, so the airspace limitation does not apply.
Comments
Please sign in to leave a comment.