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

Two issues about close pane

5 Answers 92 Views
Docking
This is a migrated thread and some comments may be shown as answers.
kyle
Top achievements
Rank 1
kyle asked on 10 Nov 2010, 10:45 AM
Hi ,

1. When two or more pane in one group and they are floating,you click the "x" to close a pane, all the panes in the group will disappear. I just want to close the current one.

2. Upinned a pane, hover over it to expand the pane,then click the "x" to close the pane.The pane is still there,until you pined it, it will disappear.

I handled the PreviewClose event, and will execute close in this event. My code is below.

please help me!

RadControls for Silverlight Q2 2010 SP2
Microsoft Silverlight Version: 4.0.50917.0
Microsoft Visual Studio 2010 Version 10.0.30319.1 RTMRel
Microsoft .NET Framework Version 4.0.30319 RTMRel

xaml code
<UserControl x:Class="DockingPane.MainPage"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">
 
    <Grid x:Name="LayoutRoot" Background="White">      
        <telerik:RadDocking x:Name="DockingControl"  PreviewClose="OnPreClose">
             
                <telerik:RadSplitContainer>
                    <telerik:RadPaneGroup>
                        <telerik:RadPane Header="Description">
                            <TextBlock TextWrapping="Wrap" Text="On the Documents tab above press Ctrl + Mouse Left button to display the Popup Menu. You can use the same combination on every tab."/>
                        </telerik:RadPane>                      
                    </telerik:RadPaneGroup>
                </telerik:RadSplitContainer>       
 
            <telerik:RadSplitContainer InitialPosition="DockedLeft">
                <telerik:RadPaneGroup>
                    <telerik:RadPane Header="Toolbox"/>                   
                </telerik:RadPaneGroup>
            </telerik:RadSplitContainer>
            <telerik:RadSplitContainer InitialPosition="DockedLeft">
                <telerik:RadPaneGroup>
                    <telerik:RadPane Header="Toolbox"/>
                </telerik:RadPaneGroup>
            </telerik:RadSplitContainer>
            <telerik:RadSplitContainer InitialPosition="DockedLeft">
                <telerik:RadPaneGroup>
                    <telerik:RadPane Header="Toolbox"/>
                </telerik:RadPaneGroup>
            </telerik:RadSplitContainer>
            <telerik:RadSplitContainer InitialPosition="DockedLeft">
                <telerik:RadPaneGroup>
                    <telerik:RadPane Header="Toolbox"/>
                </telerik:RadPaneGroup>
            </telerik:RadSplitContainer>
            <telerik:RadSplitContainer InitialPosition="DockedRight">
                <telerik:RadPaneGroup>
                    <telerik:RadPane Header="Properties"/>
                    <telerik:RadPane Header="Solution Explorer"/>
                </telerik:RadPaneGroup>
            </telerik:RadSplitContainer>
        </telerik:RadDocking>
    </Grid>
</UserControl>

c# code
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using Telerik.Windows.Controls;
using Telerik.Windows.Controls.Docking;
 
namespace DockingPane
{
    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();
        }
        
 
        private void OnPreClose(object sender, Telerik.Windows.Controls.Docking.StateChangeEventArgs e)
        {
            e.Handled = true;
            IEnumerator<RadPane> ie = e.Panes.GetEnumerator();
            ie.MoveNext();
            RadPane pane = ie.Current;
            RadPaneGroup paneGroup = pane.PaneGroup;
            RadSplitContainer rsc = paneGroup.ParentContainer;
            int count0 = DockingControl.Items.Count;
            //If two or more pane in one PaneGroup or SplitContainer,just remove the pane from its parent.
            if (paneGroup.ChildrenOfType<RadPane>().Count > 1)
            {
                pane.RemoveFromParent();
            }
            else if (rsc.ChildrenOfType<RadPane>().Count > 1)
            {
                pane.RemoveFromParent();
            }
            else
            {
                if (rsc.IsInToolWindow)
                {
                    //Remove the ToolWindow when the pane is floating.
                    ToolWindow tw = rsc.ParentOfType<ToolWindow>();
                    Canvas canvas = tw.Parent as Canvas;
                    canvas.Children.Remove(tw);
                }
                else
                {
                    DockingControl.Items.Remove(rsc);
                }
            }
            int count = DockingControl.Items.Count;
            // Remove the RadSplitContainer from DockingControl.
            foreach (UIElement element in DockingControl.Items)
            {
                RadSplitContainer sc = element as RadSplitContainer;
                if (sc.ChildrenOfType<RadPane>().Count < 1)
                {
                    DockingControl.Items.Remove(element);
                    break;
                }
            }          
        }
    }
}



5 Answers, 1 is accepted

Sort by
0
kyle
Top achievements
Rank 1
answered on 11 Nov 2010, 09:52 AM
I've solved Inssue2. But for issue 1 i need help. You can reproduce this in telerik demo, Controls>containers>docking>first look,  you put two or more panes in one group and ensure the group is floating,then click the "x" ,all the panes in the group will closed, i just want to close the current one.
0
Konstantina
Telerik team
answered on 11 Nov 2010, 01:29 PM
Hi Kyle,

Thank you for contacting us.

We are glad that you have resolved the second issue. As for point 1 - this is because the close button is closing the whole PaneGroup. I can suggest you to modify the template of the Pane and to move the close button into its header. In that way you will be able to close each pane separately, when they are floating. For more information how to achieve that you can refer to this forum post:http://www.telerik.com/community/forums/silverlight/docking/how-to-move-the-close-button-into-tab-header.aspx
Or you could use the ContextMenu of the Pane, and choose "Hide" option.

Hope this information helps. If you have further questions please let us know.

Sincerely yours,
Konstantina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
kyle
Top achievements
Rank 1
answered on 12 Nov 2010, 04:15 AM
Hi,

Thanks for your reply.

If a paneGroup is docked,then you click the "x",the pane inside it will closed one by one. Why not close the whole paneGroup? And I found if you have 3 panes in one group,you close it,the close event will execute 3 times  to close each pane.

BR
Kyle
0
Konstantina
Telerik team
answered on 15 Nov 2010, 12:57 PM
Hello Kyle,

That is because when the Panes are floating, they don't have headers, and the close button from each pane is missing. We removed the Pane's header when it is in a ToolWindow, because there were double headers, and many customers voted for removing it.

Please let us know if you have more questions.

Greetings,
Konstantina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
kyle
Top achievements
Rank 1
answered on 16 Nov 2010, 03:49 AM
Hello,

I've got it.Thanks very much!

BR
Kyle
Tags
Docking
Asked by
kyle
Top achievements
Rank 1
Answers by
kyle
Top achievements
Rank 1
Konstantina
Telerik team
Share this question
or