"This visual is not connected to a PresentationSource."

Aug 17, 2008 at 1:28 PM
Every time I try to move a DockableContent I get the above error.
Here is my code.

<Window x:Class="SagaManager.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:my="clr-namespace:AvalonDock;assembly=AvalonDock"
    xmlns:saga="clr-namespace:SagaManager"
    Title="Njorl's Saga Manager" Height="600" Width="800" Loaded="Window_Loaded">
     <DockPanel Name="dockPanel1" LastChildFill="False">
          <Menu Height="30.006" Name="MainMenu" DockPanel.Dock="Top" VerticalContentAlignment="Center">
               <MenuItem Header="File" Name="MainMenuFileItem" Click="MainMenuFileItem_Click" />
          </Menu>
          <my:DockingManager Name="mainDockingManager" >
               <my:ResizingPanel Name="verticalResizingPanel" Orientation="Vertical" >
                    <my:ResizingPanel x:Name="horizontalResizingPanel" Orientation="Horizontal">
                         <my:DockablePane x:Name="LeftDockablePane">
                              <my:DockableContent Title="Skill"></my:DockableContent>
                         </my:DockablePane>
                         <my:DocumentPane x:Name="CenterDocumentPane"></my:DocumentPane>
                         <my:DockablePane x:Name="RightDockablePane"></my:DockablePane>
                    </my:ResizingPanel>
                    <my:DockablePane x:Name="BottomDockablePane"></my:DockablePane>
                    </my:ResizingPanel>
          </my:DockingManager>
     </DockPanel>
</Window>
Aug 22, 2008 at 1:28 PM
Edited Aug 22, 2008 at 1:33 PM
That happened to me too.

Well, maybe not exactly that, but it said something about "this visual and that visual are bla bla bla..." basically not allowing me to resize the control that's inside the DockableContent. I had to close Visual Studio (end task). At least I think I clicked to resize the control, or maybe it was the DockableContent? Or pane? I'm not sure.
Aug 26, 2008 at 5:22 PM
Edited Aug 26, 2008 at 5:22 PM
In my test environment your code works fine. Why are you setting LastChildFill=false?

Anyway I suppose that problems come when you create dockable pane with no contents and dockable contents with no content.
Ado
Oct 28, 2009 at 4:02 PM

I had the similar issue with getting this exception.
I subscribed on SelectedChanged event of tab control which is
does not mean that the selection changed in WPF.
See http://dotbay.blogspot.com/2009/10/in-wpf-selectionchanged-does-not-mean.html
or http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/6c89846b-9d3b-48d7-be4e-bc202c03094d/
for more details. Hope, this will help you.
Alex.

Jun 7, 2012 at 11:55 AM

I've just had this issue. I was initializing my DockingManager on a non-visible tab page. The error is saying you can't compute a  PointToScreen on something that's not on the screen, which seems reasonable. I have found that adding an 'IsVisible' check to the DockingManager_Loaded routine fixes the issue in this instance. Here's my fix in DockingManager.cs:

		void DockingManager_Loaded(object sender, RoutedEventArgs e)
		{
			if (!DesignerProperties.GetIsInDesignMode(this))
			{
				if (this.IsVisible)
				{
					foreach (var fw in _fwList)
						fw.Owner = Window.GetWindow(this);

					CreateOverlayWindow();
					FocusElementManager.SetupFocusManagement(this);
				}
			}
		}

Jun 7, 2012 at 3:21 PM

Thanks for the issue reporting, I'll integrate it in coming releases

Jun 12, 2012 at 2:26 PM

I've submitted a patch for this ado, hopefully it will save you a little time :)

Jun 13, 2012 at 5:27 AM

i have had a similar issue reported at http://avalondock.codeplex.com/workitem/15212?ProjectName=avalondock .  Will this patch fix this issue?

Jun 13, 2012 at 9:44 AM

This fixes an issue caused when PointToScreen is called on an element that isn't on the screen. In my case it was because I have my DockingManager on a tab page that is not visible on start up. It looks like you have the same exception, but unless your DockingManager is in also on a tab control or otherwise not on screen initially then it's probably a different scenario, however the fix will likely be the same - adding a check for IsVisible, prior to calling PointToScreen.

Jun 14, 2012 at 4:53 AM

I actually don't call PointToScreen, but yes the latest version did fix my issue anyways, so great!  I can move on.

Jun 14, 2012 at 9:13 AM

Yes, I've integrated the patch from iPlexor and this issue should be fixed, thx

Jun 14, 2012 at 11:49 AM
philjohnson3 wrote:

I actually don't call PointToScreen, but yes the latest version did fix my issue anyways, so great!  I can move on.

Sorry for the confusion, I know you don't call PointToScreen directly. But that is called within AvalonDock and that's where the exception was.

Glad the fix worked :)