This is a migrated thread and some comments may be shown as answers.

Determine Source of Close

3 Answers 122 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Steve
Top achievements
Rank 1
Steve asked on 18 Jun 2012, 09:21 PM
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

3 Answers, 1 is accepted

Sort by
0
Steve
Top achievements
Rank 1
answered on 19 Jun 2012, 03:05 PM
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
0
George
Telerik team
answered on 20 Jun 2012, 10:57 AM
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 >>

0
Steve
Top achievements
Rank 1
answered on 20 Jun 2012, 03:32 PM
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
Tags
Docking
Asked by
Steve
Top achievements
Rank 1
Answers by
Steve
Top achievements
Rank 1
George
Telerik team
Share this question
or