ActiveDocument/ActiveContent not null when all documents are closed?

Jun 10, 2009 at 7:09 AM


why is it that, if I close all documents, ActiveContent and ActiveDocument are not null?
In my application, I'm binding to ActiveContent, but after closing all documents, I can still (for example) use my save command on the already closed document.
Are you planning to change that in a future release? Is there a quick fix?

Thanks in advance

Jun 10, 2009 at 12:51 PM

I posted an issue for this particular problem some time ago,

but it was not yet targeted. Please vote for it.

Jun 10, 2009 at 12:54 PM

I just did. ;)


Jun 10, 2009 at 1:34 PM

Hi chrishub and trupik,

In the demo project there is a method "doc_Closing". If you add a line

_dockingManager.ActiveDocument = null;

in that method the ActiveDocument will be null when a document is closed and will be pointing to
the next document if one is left. When there isn't any document it will be null after closing the last one.
I checked this with the PropertyGrid and it works.


Jun 12, 2009 at 6:24 AM

Danke, ich werds mal versuchen. :)

Jun 12, 2009 at 6:44 AM
Edited Jun 12, 2009 at 6:45 AM

Hm... unfortunately it doesn't work. The setter of ActiveDocument looks like this:

if (_activeDocument != value && value.ContainerPane is DocumentPane)
{ ...

There's a NullReferenceException because of value.ContainerPane.

Jun 12, 2009 at 3:58 PM


this issue should be now fixed in build 1.2.2252, could you please check if it works?

thanks for your feedback,


Jun 12, 2009 at 6:03 PM
Edited Jun 12, 2009 at 6:07 PM

Hi Ado,
I tried this but if I want to close a document it gives me an error.
It happens in the "close" method that after the line


is done the Manager is null, so I tried the following:

DocumentPane parentPane = ContainerPane as DocumentPane;
DockingManager manager = parentPane.GetManager();

I use the new "manager" instead of "Manager" and it seems to work.


There are 2 files missing in the solution: