Creating docking views Dynamically

1 posts, 0 answers
  1. James
    James avatar
    3 posts
    Member since:
    Jan 2012

    Posted 17 Jan 2012 Link to this post

    Hi,

    I'm trying to get a simple test app up and running with the following functionality:

    A main window with an empty docking container.

    A dockable view pane that is created on the fly.  (Where multiple panes are created as needed.)

    So far I have this for my main window:

    <telerik:RadDocking x:Name="radDocking" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,22,0,0">
        <telerik:RadDocking.DocumentHost>
            <telerik:RadSplitContainer>
                <telerik:RadPaneGroup x:Name="PrimaryGroup">
                </telerik:RadPaneGroup>
            </telerik:RadSplitContainer>
        </telerik:RadDocking.DocumentHost>
    </telerik:RadDocking>

    And this for my dockable pane:

    <telerik:RadPane Header="Test View">
    </telerik:RadPane>

    Where my main window is a <Window> and my view is a <UserControl>.

    This gives me an empty window, and I can create views through the main window's main menu.  The views are created and docked as follows:

    AquaView view = new AquaView();
    PrimaryGroup.Items.Add( view );

    Which gives me almost what I want - the views are created and docked in the main window by default.  (The text on the tab is missing, but I can figure that out later.)  The problem I am having now is any attempt to undock one of those views by dragging its tab results in a crash with the following callstack:

    >   PresentationFramework.dll!System.Windows.Window.GetWindow(System.Windows.DependencyObject dependencyObject) + 0x76 bytes    
        Telerik.Windows.Controls.dll!Telerik.Windows.Controls.ApplicationHelper.TransformToScreenRoot(System.Windows.UIElement target) Line 251 + 0x8 bytes C#
        Telerik.Windows.Controls.Docking.dll!Telerik.Windows.Controls.RadDocking.GetElementPositionAtScreenRoot(System.Windows.UIElement element) Line 1456 + 0x8 bytes C#
        Telerik.Windows.Controls.Docking.dll!Telerik.Windows.Controls.RadDocking.OnDockingElementDragged(System.Windows.Point globalPosition, object draggedElement) Line 607 + 0x25 bytes  C#
        Telerik.Windows.Controls.Docking.dll!Telerik.Windows.Controls.RadDocking.OnDockingElementDragged(object sender, Telerik.Windows.Controls.Docking.DragInfoEventArgs e) Line 955  C#
        Telerik.Windows.Controls.Docking.dll!Telerik.Windows.Controls.Docking.DragInfoEventArgs.InvokeEventHandler(System.Delegate genericHandler, object genericTarget) Line 49    C#
        PresentationCore.dll!System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate handler, object target) + 0x29 bytes  
        PresentationCore.dll!System.Windows.RoutedEventHandlerInfo.InvokeHandler(object target, System.Windows.RoutedEventArgs routedEventArgs) + 0x3e bytes    
        PresentationCore.dll!System.Windows.EventRoute.InvokeHandlersImpl(object source, System.Windows.RoutedEventArgs args, bool reRaised) + 0xbe bytes   
        PresentationCore.dll!System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject sender, System.Windows.RoutedEventArgs args) + 0x79 bytes  
        PresentationCore.dll!System.Windows.UIElement.RaiseEvent(System.Windows.RoutedEventArgs e) + 0x17 bytes 
        Telerik.Windows.Controls.Docking.dll!Telerik.Windows.Controls.Docking.DraggableItemHelper.OnDragDelta(System.Windows.Point globalMousePosition, System.Windows.Rect initialRect, System.Windows.Rect destinationRect, bool isResize) Line 32    C#
        Telerik.Windows.Controls.Navigation.dll!Telerik.Windows.Controls.InternalWindow.DragBehavior.OnElementMouseMove(object sender, System.Windows.Input.MouseEventArgs e) Line 149 + 0xa3 bytes C#
        PresentationCore.dll!System.Windows.Input.MouseEventArgs.InvokeEventHandler(System.Delegate genericHandler, object genericTarget) + 0x34 bytes  
        PresentationCore.dll!System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate handler, object target) + 0x29 bytes  
        PresentationCore.dll!System.Windows.RoutedEventHandlerInfo.InvokeHandler(object target, System.Windows.RoutedEventArgs routedEventArgs) + 0x3e bytes    
        PresentationCore.dll!System.Windows.EventRoute.InvokeHandlersImpl(object source, System.Windows.RoutedEventArgs args, bool reRaised) + 0xbe bytes   
        PresentationCore.dll!System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject sender, System.Windows.RoutedEventArgs args) + 0x79 bytes  
        PresentationCore.dll!System.Windows.UIElement.RaiseTrustedEvent(System.Windows.RoutedEventArgs args) + 0x41 bytes   
        PresentationCore.dll!System.Windows.UIElement.RaiseEvent(System.Windows.RoutedEventArgs args, bool trusted) + 0x2c bytes    
        PresentationCore.dll!System.Windows.Input.InputManager.ProcessStagingArea() + 0x1ff bytes   
        PresentationCore.dll!System.Windows.Input.InputManager.ProcessInput(System.Windows.Input.InputEventArgs input) + 0x45 bytes 
        PresentationCore.dll!System.Windows.Input.InputProviderSite.ReportInput(System.Windows.Input.InputReport inputReport) + 0x62 bytes  
        PresentationCore.dll!System.Windows.Interop.HwndMouseInputProvider.ReportInput(System.IntPtr hwnd, System.Windows.Input.InputMode mode, int timestamp, System.Windows.Input.RawMouseActions actions, int x, int y, int wheel) + 0x2c2 bytes 
        PresentationCore.dll!System.Windows.Interop.HwndMouseInputProvider.FilterMessage(System.IntPtr hwnd, MS.Internal.Interop.WindowMessage msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) + 0x1d3 bytes 
        PresentationCore.dll!System.Windows.Interop.HwndSource.InputFilterMessage(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) + 0x75 bytes   
        WindowsBase.dll!MS.Win32.HwndWrapper.WndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) + 0xbe bytes    
        WindowsBase.dll!MS.Win32.HwndSubclass.DispatcherCallbackOperation(object o) + 0x7d bytes    
        WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs) + 0x53 bytes 
        WindowsBase.dll!MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(object source, System.Delegate method, object args, int numArgs, System.Delegate catchHandler) + 0x42 bytes    
        WindowsBase.dll!System.Windows.Threading.Dispatcher.InvokeImpl(System.Windows.Threading.DispatcherPriority priority, System.TimeSpan timeout, System.Delegate method, object args, int numArgs) + 0xb4 bytes    
        WindowsBase.dll!MS.Win32.HwndSubclass.SubclassWndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam) + 0x104 bytes    
        [Native to Managed Transition]  
        [Managed to Native Transition]  
        WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame frame) + 0xc1 bytes  
        WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame frame) + 0x49 bytes  
        PresentationFramework.dll!System.Windows.Application.RunDispatcher(object ignore) + 0x5b bytes  
        PresentationFramework.dll!System.Windows.Application.RunInternal(System.Windows.Window window) + 0x74 bytes 
        PresentationFramework.dll!System.Windows.Application.Run(System.Windows.Window window) + 0x2b bytes 
        PresentationFramework.dll!System.Windows.Application.Run() + 0x1b bytes 
        AquaViewPro.exe!AquaViewPro.App.Main() + 0x5e bytes C#
        [Native to Managed Transition]  
        [Managed to Native Transition]  
        mscorlib.dll!System.AppDomain.ExecuteAssembly(string assemblyFile, System.Security.Policy.Evidence assemblySecurity, string[] args) + 0x6d bytes    
        Microsoft.VisualStudio.HostingProcess.Utilities.dll!Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() + 0x2a bytes  
        mscorlib.dll!System.Threading.ThreadHelper.ThreadStart_Context(object state) + 0x63 bytes   
        mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool ignoreSyncCtx) + 0xb0 bytes    
        mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0x2c bytes    
        mscorlib.dll!System.Threading.ThreadHelper.ThreadStart() + 0x44 bytes   
        [Native to Managed Transition]  

    The output window of Visual Studio has the following (extremely unhelpful) message:

    An unhandled exception of type 'System.ArgumentNullException' occurred in PresentationFramework.dll
    Additional information: Value cannot be null.

    So, I'm wondering what it is I'm missing, or does the WPF docking library not support creating views dynamically?  (All the samples and examples I've seen do only seem to build static GUIs where all the components are known at compile time.)

    Regards,

    James

Back to Top