Determine Source of Close

4 posts, 0 answers
  1. Steve
    Steve avatar
    124 posts
    Member since:
    Jun 2011

    Posted 18 Jun 2012 Link to this post

    Now that there is a CloseButtonPostion property which can be set to InPaneAndGroup, is there any way to determine the source of the PreviewClose event; either from a pane or from the group?  If not it would be useful.

    Thanks in advance,
    Steve
  2. Steve
    Steve avatar
    124 posts
    Member since:
    Jun 2011

    Posted 19 Jun 2012 Link to this post

    I wasn't able to find any straight forward way, but I came up with a bit of a kludge if anyone's interested...
    void OnPreviewClose(object sender, Telerik.Windows.Controls.Docking.StateChangeEventArgs e)
    {
        RadPane pane = e.Panes.ToList()[0];
        Point pt = Mouse.GetPosition(pane);
        if (pt.X <= pane.ActualWidth)
        {
            // the close came from the pane
        }
        else
        {
            // the close came from the group
        }
    }

    Still, it would be nice if there were some property that could be tested.
    Thanks,
    Steve
  3. UI for WPF is Visual Studio 2017 Ready
  4. George
    Admin
    George avatar
    1332 posts

    Posted 20 Jun 2012 Link to this post

    Hello Steve,

    In the RadDocking control there is no definition of "closing a PaneGroup", but only "closing a pane". The RadPaneGroup will be closed (hidden) automatically when it doesn't contain any visible panes. In this scenario I would suggest the following code:

    private void dock_PreviewClose(object sender, Telerik.Windows.Controls.Docking.StateChangeEventArgs e)
    {
        RadPane pane = e.Panes.ToList()[0];
        if (pane.PaneGroup.Items.Count == 1)
        {
            // this is the last pane in the group and the group will be closed as well.
        }
    }

    Hope this helps.


    Regards,
    George
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  5. Steve
    Steve avatar
    124 posts
    Member since:
    Jun 2011

    Posted 20 Jun 2012 Link to this post

    Hi George,
    Actually I just wanted a way to tell if the user clicked the close button on a pane as opposed to the one on the group.  By doing so I was able to implement a close all on the group button.
    Thanks,Steve
Back to Top