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

closing/retrieving panels

15 Answers 257 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Rick Mueller
Top achievements
Rank 1
Rick Mueller asked on 23 Nov 2010, 06:37 PM
Hello,

If a user closes a panel then its Hidden?
If its hidden how would you unhide the panel and know which panel is closed?

regards,
Rick

15 Answers, 1 is accepted

Sort by
0
George
Telerik team
answered on 24 Nov 2010, 05:44 PM
Hello Rick,

Could you please specify why do you need to know which RadPane is hidden and which is closed? RadDocking don't have such feature to unhide the hidden RadPane. 

All the best,
George
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Rick Mueller
Top achievements
Rank 1
answered on 24 Nov 2010, 06:30 PM
George<

Thank you,

So let me rephrase the question.

If the user arranges the panes accordingly and closes a certain pane.
 How would the user re-establishes the the pane it just closed?

Thoughts

Rick
0
George
Telerik team
answered on 28 Nov 2010, 07:46 PM
Hello Rick,

When the user closes a RadPane, this pane is actually hidden, but it is not disposed and you could find it in the RadDocking.Panes collection. For this pane, IsHidden property is set to True. But the user cannot reestablish the closed panes. 

If you want to reestablish a closed pane, you could iterate RadDocking.Panes collection, find the hidden pane and set RadPane.IsHidden property to False.

I hope this helps.

Sincerely yours,
George
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Rick Mueller
Top achievements
Rank 1
answered on 29 Nov 2010, 01:53 AM
Thank you,

Could you supply code snippet  to unhide a pane.

Regards,
Rick
0
Rick Mueller
Top achievements
Rank 1
answered on 29 Nov 2010, 02:37 AM
Thank you,

Could you supply code snippet  to unhide a pane.

Regards,
Rick
0
George
Telerik team
answered on 01 Dec 2010, 12:26 PM
Hello Rick,

Attached you can find the project. I hope this helps. 

All the best,
George
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Rick Mueller
Top achievements
Rank 1
answered on 01 Dec 2010, 04:31 PM
Hey George,
Thank you
Very clean approach.
It was all done in the xaml side MVVM pattern.

I do have one more question then i"ll stop buggin ya.

The current xaml is set up nice, but when you add another pane and checkbox and change the element name it will close all the panes and select all the checkboxes.
How can i close one adn keep the other one open?
<Grid x:Name="LayoutRoot" Background="White">
  
        <CheckBox x:Name="check1" IsChecked="{Binding IsHidden, Mode=TwoWay}" Content="Pane1" />
        <CheckBox x:Name="check2" IsChecked="{Binding IsHidden, Mode=TwoWay}" Content="Pane2" Margin="16,16,16,625" />
  
        <telerik:RadDocking Name="RadDocking" HasDocumentHost="False" Close="RadDocking_Close" Show="RadDocking_Show" Margin="0, 50, 0, 0">
            <telerik:RadSplitContainer>
                <telerik:RadPaneGroup >
                    <telerik:RadPane  Title="Pane 1" IsHidden="{Binding DataContext.IsHidden, ElementName=check1, Mode=TwoWay}">
                        <TextBlock Text="Some simple text here"/>
                    </telerik:RadPane>
                    <telerik:RadPane  Title="Pane 2" IsHidden="{Binding DataContext.IsHidden, ElementName=check2, Mode=TwoWay}">
                        <TextBlock Text="Some simple text here"/>
                    </telerik:RadPane>
                </telerik:RadPaneGroup>
            </telerik:RadSplitContainer>
  
        </telerik:RadDocking>
    </Grid>
0
George
Telerik team
answered on 06 Dec 2010, 09:53 AM
Hi Rick,

I would suggest you two approaches:

  •  Remove the binding between the CheckBoxes and the ViewModel. Please, refer to the code below:

<Grid x:Name="LayoutRoot" Background="White">
        <CheckBox x:Name="check1" Content="Pane1"  />
        <CheckBox x:Name="check2"  Content="Pane2" Margin="16,16,16,625" />
 
        <telerik:RadDocking Name="RadDocking" HasDocumentHost="False" Margin="0, 50, 0, 0">
            <telerik:RadSplitContainer>
                <telerik:RadPaneGroup >
                    <telerik:RadPane  Title="Pane 1" IsHidden="{Binding IsChecked, ElementName=check1, Mode=TwoWay}">
                        <TextBlock Text="Some simple text here"/>
                    </telerik:RadPane>
                    <telerik:RadPane  Title="Pane 2" IsHidden="{Binding IsChecked, ElementName=check2, Mode=TwoWay}">
                        <TextBlock Text="Some simple text here"/>
                    </telerik:RadPane>
                </telerik:RadPaneGroup>
            </telerik:RadSplitContainer>
        </telerik:RadDocking>
    </Grid>

  • Create a different property in the ViewModel for each CheckBox and bind the CheckBoxes to these properties.

Please do not hesitate to contact us if you require any further information.


Best wishes,
George
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Rugarciap
Top achievements
Rank 1
answered on 29 Oct 2012, 11:03 AM
Hi all

We're developing a Siverlight App that uses RadDocking as its main container component. This post has been very useful for us, but we found a problem with this aproach.

Our App allows the user to drag and drop elements dynamically to the RadDock with unlimited instances of each element. The app also allows the user to persist and load the user configuration. For that, we're using the seralization feature that RadDocking provides.

As you said, we've detected that when you "close" (not hide) a panel inside the Dock, the panel is not actually closed but hidden and it remains on the items collection. When we request to the RadDocking component to serialize its content, it's generating the XML fine, including the visible items, but also the hidden ones.

That's the problem. This behaviour could cause future problems since the seralization XML will grow up until infinitum :( depending on the user configuration. In example, if the user drags a Pane and remove it twice, the XML will generate 2 entries even if the app has no pane loaded.

We've tried to remove the Panes from the Items collection manually when the "close" (actually hide) event is called, but without success, since if the pane is docked with other one, all of them are closed. Is there any way to force the disposal of the pane when the "close" (not hide) event is called (or another approach using the Telerik API) in order to limit the size of the seralized XML? 

Thank you very much in advance.

Best,
Rubén.
0
George
Telerik team
answered on 01 Nov 2012, 10:05 AM
Hi Rubén,

Your remarks are correct. In the given scenario I would suggest using the RadPane.RemoveFromParent() method. Using this approach, make sure you don't keep any references to the RadPane or to its content. Otherwise, it won't be disposed.

Hope this helps.

Kind regards,
George
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Rugarciap
Top achievements
Rank 1
answered on 02 Nov 2012, 08:04 AM
Hi George!

Thank you very much for the fast response, but sadly it did't worked. The XML is still generating entries for the "hidden" (not removed) panes, with its "selectedIndex" attribute equals to "-1".

We've checked if the pane is being referenced elsewhere on the code ant it's not, neither its content, which we're freeing just before calling "removeFromParent".

If it helps, while debugging, we've inspected the "Parent" attribute of the pane being hidden, and it's set to null.

Here is the code that actually tries to close the pane.

private void radMainDocking_Close(object sender, StateChangeEventArgs e)
        {
            try
            {
                if (!(sender is RadDocking)) return;

                RadPane pane = ((RadDocking)sender).ActivePane;
                if (pane != null)
                {
                   
   ... cleanup code

                    /// Finally remove the pane from parent                    
                    pane.RemoveFromParent();
                }
          ......

To add the RadPanes to the RadDocking, we're creating dynamically a RadPaneGroup containing the RadPane, and a RadSplitContainer containing the RadPaneGroup. I suppose the Parent attribute should be equals to the RadPaneGroup, never null. What we're adding to the RadDocking items collection is the RadSplitContainer instance, 

We're running out of ideas here... :(

If you don't see any workaround for this, can we assume the XML attribute "selectedIndex" will be equals to "-1" only when a RadPane is hidden? If so, we could manipulate the XML ourselves to remove those entries in order to keep the serialized XML as little as needed depending on the number of panes really opened.

Thank you very much again for your help.

Rubén.

0
George
Telerik team
answered on 07 Nov 2012, 12:10 PM
Hello Rubén,

The RadDocking excludes all autogenerated items from saving if they are empty (all panes are removed). In the given scenario the groups and the splitcontainer are saved, because they are generated in runtime from external code (not in the RadDocking itself and they are not marked as autogenerated). In this case the best option is to modify the xml and remove all empty elements.

I logged a feature request for the control that will help in such common scenarios. The PITS item is here - http://www.telerik.com/support/pits.aspx#/public/silverlight/13314 and you could vote for it and track its progress. We will definitely look into it in our further development.


Kind regards,
George
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Rugarciap
Top achievements
Rank 1
answered on 09 Nov 2012, 07:47 AM
Hello George,

Thanks again!, Glad to hear that :).

In the meantime, just one last question please. When you say "In this case the best option is to modify the xml and remove all empty elements"..., based on which criteria? Can we assume that if one panel contains its "selectedIndex" attribute equals to "-1" it means it has been hidden by the user?

Thanks again!!!

Best, 
Rubén.
0
George
Telerik team
answered on 14 Nov 2012, 11:54 AM
Hello Rubén,

Setting the SelectedIndex to -1 means that either all panes in this pane group are hidden, or the group is empty (all panes are removed from the items collection). In your scenario I suppose you won't have any hidden panes because you removed them using the RemoveFromParent method. With these words, you could assume that if the SelectedIndex is -1, the group is empty and it must be removed from the xml.

All the best,
George
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Rugarciap
Top achievements
Rank 1
answered on 21 Nov 2012, 04:43 PM
Thank you very much!!

We'll use that workaround for now.

Best,
Rubén.
Tags
Docking
Asked by
Rick Mueller
Top achievements
Rank 1
Answers by
George
Telerik team
Rick Mueller
Top achievements
Rank 1
Rugarciap
Top achievements
Rank 1
Share this question
or