Skip to content

AvalonDock: recommended way to disable hiding behavior for LayoutAnchorable and friends #1500

Open
@SirUppyPancakes

Description

@SirUppyPancakes

Somewhat related to #1117

LayoutAnchorable sets CanClose to false by default, and I noticed that the code also does unexpected things like coercing CanClose to false when you tear a LayoutAnchorable off of a LayoutDocumentPane.

My goal is to not have "hiding" behavior at all, as it just creates memory leaks for my use-cases. When a user closes a LayoutAnchorable, I always want it to close permanently.

So far, the only approach I have been able to come up with is to set CanClose and CanHide to true and add these handlers to Closed and Hiding on every single LayoutAnchorable:

        private void PaneClosed(object sender, EventArgs e)
        {
            // closed logic here
        }

        private void PaneHiding(object sender, CancelEventArgs e)
        {
            e.Cancel = true;
            (sender as LayoutContent)?.Close();
        }

This feels super hack-y, but my other attempts to get the behavior I need have failed. Is this the best I can do to get this behavior for now?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions