Drag a DockableContent or a DocumentContent ?

Jun 26, 2010 at 12:16 PM
Edited Jun 26, 2010 at 12:19 PM

Hello,

I am a developer of the Sofa WPF team. Our project (SofaWpf.codeplex.com) is, in short, a Container that hosts Applications that are developed and deployed separately but can communicate and cooperate when running in the Container.

We use 3 different frameworks for the graphical layout, WPF.MDI, DragDockPanel from the Blacklight project and, mainly, Avalon Dock.

We are currently facing a major issue that does not affect the current release but forbid us to go ahead:

Everything works correctly as long we only open DocumentContents in a DocumentPane (what does the current release) or DockableContents in a DockablePane. The problem occurs when we open 2 panes, a DocumentPane and a DockablePane, and drag a DockableContent into a DocumentPane. The DockableContent behaves correctly and gets the DocumentContent look (tab on top) but still behaves as a DockableContent when we drag it again. This generates the following error:

System.InvalidOperationException: 'DocumentPane' TargetType does not match type of element 'FloatingDockablePane'.

Exception.StackTrace:

   at System.Windows.Style.CheckTargetType(Object element)

...

   at System.Windows.StyleHelper.UpdateStyleCache(FrameworkElement fe, FrameworkContentElement ...

   at System.Windows.FrameworkElement.set_Style(Style value)

   at AvalonDock.DockableFloatingWindow..ctor(DockingManager manager, DockableContent content) dans C:\Sofa-06-20\{A3634D}+\Sofa\ExternalFrameworks\AvalonDock\DockableFloatingWindow.cs:ligne 89

   at AvalonDock.DockingManager.Drag(DockableContent dockableContent, Point point, Point offset) dans c:\sofa-06-20\{a3634d}+\sofa\externalframeworks\avalondock\dockingmanager.cs:ligne 2362

   at AvalonDock.DockableContent.OnDragStart(Point ptMouse, Point ptRelativeMouse) dans c:\sofa-06-20\{a3634d}+\sofa\externalframeworks\avalondock\dockablecontent.cs:ligne 219

   at AvalonDock.ManagedContent.OnDragMouseLeave(Object sender, MouseEventArgs e) dans c:\sofa-06-20\{a3634d}+\sofa\externalframeworks\avalondock\managedcontent.cs:ligne 303

   at System.Windows.Input.MouseEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)

   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)

...

Somebody already had this error and a comment was:

"gidmanmaDCT wrote May 6 at 8:56 PM

This is manifesting as a template error but it seems that the real problem is that dockable content exists within a document pane. Should this be allowed? "

 

This let me think there is some kind of "casting" from DockableContent to DocumentContent that is done when dragging a DockableContent to a DocumentPane and this does not occurs when Avalon Dock is running inside Sofa WPF.

I do not hope a ready-to-use solution for this problem but ideas for search: Am I right when thinking about a casting from Dockable to Document, if yes where in the Avalon code, if not how is managed a DockableContent that has been dragged in a DocumentPane ? Any other ideas ?

 At last a lot of thanks to the Avalon Dock team and all my consideration for this great work !   

Edward G. Georges

 

Jun 27, 2010 at 11:47 AM
Edited Jun 27, 2010 at 11:55 AM

Edit to my previous post: The solution to make it work was very simple:

The last Avalon statement before the error was in the DockableFloatingWindow constructor, at line 89 :

pane.Style = content.ContainerPane.Style;

In samples I tried using Avalon without embedding it in Sofa content.ContainerPane.Style is always null. So I replaced

pane.Style = content.ContainerPane.Style;

by

pane.Style = null;

and it works. But I guess this line may have a role in some circumstances ...

Is it possible to get information about side effects of my modification ?

Edward H. Georges

Jun 28, 2010 at 12:42 PM

Hi, it seems that you are using old source code, could please specify which changest/version are you using? I can't find the line you're referring to...

Ado

Jun 28, 2010 at 9:50 PM

Hello,

 

I am using release 60576 (latest available), version 1.2 ie .Net 3.5

After I set pane.Style to null instead of content.ContainerPane.Style I had no problems even when testing deeply. This line is probably not meaningful when Avalon is embedded in Sofa.

Thanks for your time

Edward