Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
45
How to prevent new unpinned ContentPane from hiding immediately
posted

Hello,

I have a layout with Document Host in the middle of the app and unpinned panes on the side.

User can add additional panes to the side. They are created from C# code and set to be unpinned by default.

The problem that I am having is that those newly created panes are shown for half a second, and then immediately hidden.

Is there some way I can force it to stay visible until user clicks away?

EDIT:

I managed to get what I want with a dirty hack below, I still wonder if it maybe can be done better:

private ContentPane CreateSidePane()
{
    var cp = new ContentPane();
    cp.IsPinned = false;
    cp.IsFlyInSuspended = true;
    cp.LostFocus += LostInitialFocus;
    return cp;
}

private void LostInitialFocus(object sender, RoutedEventArgs e)
{
    var cp = sender as ContentPane;
    cp.LostFocus -= LostInitialFocus;
    cp.IsFlyInSuspended = false;
}

  • 3520
    Verified Answer
    Offline posted

    Hello Bartosz,

     

    That is correct - the proper way to prevent the content pane's flyout from flying right back in is to set its IsFlyInSuspended property to true. For resetting this property, though, I would recommend handling the XamDockManager's ActivePaneChanged event (instead of LostFocus which deals with logical focus) and set the property to false. This way as soon as the user attempts to activate another pane, the fly out would be hidden as expected for an unpinned pane. I am attaching a sample application using the mentioned approach.

    Please let me know if I can provide any further assistance.

    DockManagerSample.zip