问题
I have an AvalonDock DockingManager control with some child Anchorables (no Documents). If these Anchorables are floated from the main DockingManager, I'm aware they are still part of the DockingManager's logical tree.
However, I've had some requests from users that the floating windows be more independent from the main window by "disabling" some features:
- When any window (parent or child) is focussed, all windows are brought to the front
- When the parent window is minimised, so are all floating child windows.
I'm completely stumped as to how I could go about this, short of editing the AvalonDock source (which I'd rather not do given the option).
Is there a way to do either of these things?
回答1:
Set the property Owner of a floating window to null to detach it from its logical parent.
{
dockManager.LayoutUpdated += DockManager_OnLayoutUpdated;
}
private void DockManager_OnLayoutUpdated(object sender, EventArgs e)
{
foreach (var floatingWindow in dockManager.FloatingWindows)
{
if (floatingWindow.Owner != null)
{
floatingWindow.Owner = null;
}
}
}
来源:https://stackoverflow.com/questions/30667262/can-avalon-dock-floating-anchorables-be-more-independent-from-their-parent