This is a migrated thread and some comments may be shown as answers.

Creating docking views Dynamically

3 Answers 124 Views
Docking
This is a migrated thread and some comments may be shown as answers.
James
Top achievements
Rank 1
James asked on 17 Jan 2012, 01:20 PM

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

3 Answers, 1 is accepted

Sort by
0
Hans
Top achievements
Rank 1
Veteran
answered on 02 Oct 2019, 06:39 AM

Hi,

I need the same functionality as James.  Just like James I cannot find any example where content is added dynamically.  Any help would be much appreciated.

Regards,
Hans

0
Dinko
Telerik team
answered on 04 Oct 2019, 01:15 PM

Hi Hans,

I have prepared a sample project which demonstrates how you can add runtime RadPanes to the control. In the attached project, before the RadPane is added I am setting a UserControl to its Content property.

I hope this project will be helpful.

Regards,
Dinko
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Hans
Top achievements
Rank 1
Veteran
answered on 07 Oct 2019, 09:25 AM

Hi Dinko,

thanks for the sample project.  With this project and the ones I've found in the SDK samples browser I'm sure I'll get things done.

Regards
Hans

 
Tags
Docking
Asked by
James
Top achievements
Rank 1
Answers by
Hans
Top achievements
Rank 1
Veteran
Dinko
Telerik team
Share this question
or