I am using Avalon 1.3.3571.0 in a WPF application and have a question regarding
DockableContent.Close(). I read the discussion in earlier threads but could find an answer:
"If DockableContent.IsCloseable property is false (as default) content is not closed but only hidden (same effect as calling Hide() method).
In the latter case it's removed from the controls tree and it's not more present under DockingManager.DockableContents list.
If forceClose is true, IsCloseabled state is not considered."
Ok, the 'X' hides rather than closes a DockableContent. But how to close a DockableContent ?
Let's assume that I have MyDockableContent and I want to be able to init multiple instances of it and pressing the 'X' should close the active MyDockableContent in question. I can include a StateChanged event handler, check the state and close MyDockableContent
if it is hidden. But that does not work! If I check dockingManager.DockableContents.Count the count does not decrease, it increases with each instance.
Any help would be highly appreciated since I like this control.
Here is a simple code:
private static DockingManager dockingManager;
public static void ShowMyDockableContent(DockingManager dockManager)
dockingManager = dockManager;
MyDockableContent dockableContent = new MyDockableContent();
dockableContent.IsCloseable = true;
dockableContent.StateChanged += new System.Windows.RoutedEventHandler(dockableContent_StateChanged);
static void dockableContent_StateChanged(object sender, System.Windows.RoutedEventArgs e)
if (sender.GetType().BaseType == typeof(DockableContent))
DockableContent dockableContent = (DockableContent)sender;
if (dockableContent.State == DockableContentState.Hidden)
Console.WriteLine("Count: " + dockingManager.DockableContents.Count);