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

RadSplitContainer cause to error

17 Answers 314 Views
Docking
This is a migrated thread and some comments may be shown as answers.
hayula
Top achievements
Rank 1
hayula asked on 06 Apr 2009, 09:10 AM
hi,
i have a docking control that cause to error in run time.
when remove the line 5, and 11. the application run fine.
but i saw some bad things on ui(like spliter that not placed fine), i dont know if its due to my changes.
this is my code:

 

   <Grid> 
        <radDock:RadDocking x:Name="radDocking1">  
            <radDock:RadDocking.DocumentHostContent> 
 
                <radDock:RadSplitContainer> 
                    <radDock:RadPaneGroup> 
                        <radDock:RadDocumentPane Title="Description" Content="Some content" /> 
                    </radDock:RadPaneGroup> 
                </radDock:RadSplitContainer> 
 
            </radDock:RadDocking.DocumentHostContent> 
            <radDock:RadDocking.SplitContainers> 
                <radDock:RadSplitContainer Width="150" MaxWidth="600" Name="LeftContainer" InitialPosition="DockedLeft">  
                    <radDock:RadPaneGroup x:Name="Group1">  
 
                        <radDock:RadPane x:Name="Pane2" Header="Toolbox">  
                            <Button Width="100" Height="40" Content="ghgfhfghfgh" Background="Blue"></Button> 
                        </radDock:RadPane> 
                    </radDock:RadPaneGroup> 
                </radDock:RadSplitContainer> 
 
                <radDock:RadSplitContainer Width="200" MaxWidth="679" x:Name="RightContainer" InitialPosition="DockedRight">  
                    <radDock:RadPaneGroup x:Name="Group2">  
 
                        <radDock:RadPane x:Name="Pane4" Header="Properties">  
                            <Button Width="100" Height="40" Content="ghgfhfghfgh"></Button> 
                        </radDock:RadPane> 
                    </radDock:RadPaneGroup> 
                </radDock:RadSplitContainer> 
 
 
            </radDock:RadDocking.SplitContainers> 
        </radDock:RadDocking> 
    </Grid> 

 

17 Answers, 1 is accepted

Sort by
0
Accepted
Miroslav Nedyalkov
Telerik team
answered on 06 Apr 2009, 03:54 PM
Hi hayula,

Which version of RadControls for Silverlight are you using? This code won't work with the latest one for two reasons:
1) There is no property with name DocumentHostContent, its name is DocumentHost now;
2) We removed the SplitContainers property - now you just need to add the split containers as children of the docking control.
When I change these two things everything works fine. Hope this information helps.

All the best,
Miroslav Nedyalkov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Vikash
Top achievements
Rank 1
answered on 17 Apr 2009, 02:52 AM
Hi Miroslav,
   I am creating RadPane on run time (ie on a button click)
This is what I do.

        pane.Content = grid;
        paneGroup.AddItem(pane, (DockPosition)2);

 

        splitContainer.Items.Add(paneGroup);

        mainDocking.Children.Add(splitContainer);

(grid is having a graph.)

On first time, on button click, it all works fine.
My requirement is that, on button click,if this Pane already exists, remove this pane and recreate every things again.

This is how I remove.

 

private 

 

void RemovePane(RadPane Pane)  

 

 

{    
    

 if (PaneExists(Pane.Name))     
    { 

 

 

 

 

        RadPaneGroup rpg = new RadPaneGroup ();

 

        RadSplitContainer rsc = new RadSplitContainer();  

 

        rpg = Pane.ParentOfType<

RadPaneGroup>();

 

 

 

        rsc = rpg.ParentOfType<

RadSplitContainer>();

 

 

 

 

        Pane.RemoveFromParent();

        rpg.RemoveFromParent();

        mainDocking.Children.Remove(rpg);

    }

}

I think, the code for Pane exists is irrilivant here, but this is how I do

 

private

 

 

bool PaneExists(string paneName)  

 

    bool recordFound = false

    IEnumerable<RadPane> existingPanes = mainDocking.Panes;

 

    foreach (RadPane record in existingPanes) 
    {

 

        if (record.Name == paneName) 
        {

            recordFound =

true
            closingPane = record;  

 

 

 

 

            break;  

         }

      } 

 

        return recordFound; 

}

 

 

After RemovePane is done, I need to create Pane again so the same piece of code as above is called again.
        pane.Content = grid;
        paneGroup.AddItem(pane, (DockPosition)2);

 

        splitContainer.Items.Add(paneGroup);

        mainDocking.Children.Add(splitContainer);

At last line, it gives me "ArgumentException".   Error message further says : Sys.InvalidOperationException: ManagedRuntimeError error#4004 in conrtol 'Xaml1': System.argumentException: Value doesnot fall within the expected range.


Any idea what is wrong here.

Thanks & Regards,
Vikash Sinha
ADP Inc.

 

 

 

 

 

 

0
Miroslav Nedyalkov
Telerik team
answered on 21 Apr 2009, 11:56 AM
Hello Vikash,

The method AddItem is not meant to add panes to a pane group. You should use the Items collection instead. To remove an item (pane) from a pane group you should use the RemoveFromParent method of the pane, because most commonly you don't know where the pane is. Please, take a look at the attached example.
Hope this information helps.

Regards,
Miroslav Nedyalkov
the Telerik team

Instantly find answers to your questions on the newTelerik Support Portal.
Check out the tipsfor optimizing your support resource searches.
0
Vikash
Top achievements
Rank 1
answered on 24 Apr 2009, 12:05 AM
Hi Miroslav, 
   Thanks for the Demo Project but it is still not working for me.
In your example, go on and add 4 panes by clicking on the add panes button 4 times. 
Try getting the value of RadDocking.Panes. It has 5 Pane (one of ur design time and 4 we added at runtime)

Now, close 2 panes created by runtime either by clicking X icon or the button you have placed on these panes. 
Try getting the value of RadDocking.Panes. It still has 5 Pane. 

Why?
 I was expecting 3 Panes since I removed 2 from the parent.

Because of this, RadDocking.SaveLayout creates extra node into XML it generates and if you load your panes from this saved XML, it flickers. 

Also, now with all the 5 panes on, make one of the Pane tabbed document. Now Count the RadDocking.Panes --- Now it is Only 4
and now if I do RadDocking.SaveLayout --- Tabbed Pane, even though I did not remove this, is not saved in the resultant XML String. 

So, My question is :
1) When I am clicking X icon, that Pane should be gone from memory ie RadDocking.SaveLayout should not create a node for Pane I choosed to delete/remove. 
How Do I achive this?

2) when I made a Pane tabbed document, I did not remove that from docking. So when I do RadDocking.SaveLayout, there should be a node for that so that I can reload that back. 
How do I achieve this?

Appreciate your quick reply







 


Hello Vikash,

The method AddItem is not meant to add panes to a pane group. You should use the Items collection instead. To remove an item (pane) from a pane group you should use the RemoveFromParent method of the pane, because most commonly you don't know where the pane is. Please, take a look at the attached example.
Hope this information helps.

Regards,
Miroslav Nedyalkov
the Telerik team
0
Miroslav Nedyalkov
Telerik team
answered on 24 Apr 2009, 03:14 PM
Hello Vikash,

We planned to implement different types of closing behavior for the docking control (in the future) and we decided to implement only the "hide" behavior that makes the pane hidden when you click the X instead of removing it from the memory first.
If you hide a pane (either by clicking the X or by setting its Hidden property to true), the pane will stay in the Panes collection, but will be removed from the Items collection, which causes it to disappear.

If you unpin the pane, it will again stay in the Panes collection, but will be removed from the Items collection.

That means that you have 2 ways to get all the panes that are shown in the group:
1. Ue the Items collection;
2. Gt only the panes from the Panes collection that are not Hidden(Hidden=false) and are Pinned(Pinned=true).

When you put a pane in the Document Host it will be physically moved in a different PageGroup so it will be removed from its parent first.

I hope this information helps you understand how the docking control works. If you have further questions, don't hesitate to ask.

Regards,
Miroslav Nedyalkov
the Telerik team

Instantly find answers to your questions on the newTelerik Support Portal.
Check out the tipsfor optimizing your support resource searches.
0
Vikash
Top achievements
Rank 1
answered on 25 Apr 2009, 01:27 AM
Miroslav,
   Thanks for your reply, but this still doesnot solve my problem.

I do  RadDocking.SaveLayout  and save the output of this into database.

with this, even my Hidden Panes are saved. Now when I do

RadDocking.LoadLayout, because of those hidden panes, it flickers .

This is not a big issue in dummy projects but in my case, I am putting Charts on the Panes and have to reload those charts when I do RadDocking.LoadLayout.

Hidden ones becomes visible for micro-minutes and Chart gets on them and then Panes gets hidden. If this behaviour occur 15 times while u r reloading the Panes, this flickers looks very very bad and since all the hidden panes are getting saved, this flicker will increase in future (ofcourse unless I delete the saved Records from Database, which is really not an option)

so, my question is, if on RadDocking.SaveLayout, I donot wish to save Hidden Panes, what do I need to do.

Thanks & regards,
Vikash Sinha
0
Miroslav Nedyalkov
Telerik team
answered on 27 Apr 2009, 03:40 PM
Hello Vikash,

This is not currently supported by the docking control. We are planning to make the XML generating/parsing logic customizable and extensible in the future. At the moment, the only way is to go through the XML and remove all the panes that have their IsHidden property set to True. The reason why we are putting the panes in the XML is because in other case we will change the behavior of the control - when you load the panes and the hidden panes are not in the XML they become from hidden to destroyed. We will put the "flickering problem" in our tasks list and hopefully we will include the fix in the next release. If we fix it earlier, we will include it in the Latest Internal Builds section.

Regards,
Miroslav Nedyalkov
the Telerik team

Instantly find answers to your questions on the newTelerik Support Portal.
Check out the tipsfor optimizing your support resource searches.
0
Vikash
Top achievements
Rank 1
answered on 28 Apr 2009, 02:11 AM
Hi Miroslav,
   that breaks my heart. :)

I know how to delete Node from XML in C# but in Silverlight, its all togather a different ball game with LINQ and all. I donot wish to dive deep into LINQ at this moment.

Do you have any handy code which deletes nodes from XML in Silverlight

Thanks & Regards,
Vikash Sinha
0
Miroslav Nedyalkov
Telerik team
answered on 28 Apr 2009, 09:20 AM
Hello Vikash,

I have an idea! You could implement destroy behavior with the following code:
Miroslav Nedyalkov
0
Vikash
Top achievements
Rank 1
answered on 28 Apr 2009, 10:43 PM
Miroslav,
   Where is the code?

I guess you missed to paste that.


Thanks & Regards,
Vikash
0
Miroslav Nedyalkov
Telerik team
answered on 29 Apr 2009, 07:25 AM
Hello Vikash,

I'm sorry, but the code was cut!
I'm attaching the example to avoid this error.
Please take a look at the RadDocking_ClosePane method in the code-behind class.

Regards,
Miroslav Nedyalkov
0
Vikash
Top achievements
Rank 1
answered on 02 May 2009, 07:17 AM
Hi Miroslav,
   What is special in this code?

You create 50 Panes and then do "RemoveFromParent" in foreach loop and then do a RadDocking.SaveLayout ---- You will get 50 entries(Node) for Rad Pane and that is the issue here. This does not solve my problem.

The fact that you are able to do  

foreach

 

(RadPane pane in e.Panes)

 

{

pane.RemoveFromParent();

}

means that pane is not getting destroyed but just getting hidden or whatever otherwise ForEach would have crashed at runtime in second run.

My problem is that when I am doing RadDocking.SaveLayout, I donot want this invisible panes in my XML because if I load this XML, it causes pane to flicker.

Either you have not tested this before you posted or u r not getting my question. If it is the later case, please let me know and I will rewrite my question again. 

Since  u guys have the code, u must be knowing it better but thanks to all the problem I am facing because of this, I can give u a much better solution than this. (a Workaround) but I donot want to do that because that is another stupid bug of telerik.

but any way, to remove a hidden pane, u can do pane.menucommand[2].Notify(Pane)

for some reason, it deletes the Pane and if I do RadDocking.SaveLayout, it does not create this node in XML so this works fine for me but I feel this is obviously a bug and once you fix this bug, my system will not work so i can not rely on this bug as a feature.

If only I had known when I started this project that Docking component of telerik is so bugy.
Wonder why other developer has not faced this. May be they are wiser than me and looked for some other 3rd party components and not paid usd 1300 for a componenets that has nothing but bugs bugs and more bugs.
Amount of time I have spend in finding a  workaround, I wonder, it would have been a better idea to write a docking component all by myself and not rely on some buggy 3rd Party so Called RAD tool.

Sorry to say my friend, but its not a Rapid Application Development tool. May be u guys have some other meaning of RAD

Severly disappoined by the product as well as support.

Kind Regards,
Vikash Sinha



0
Miroslav Nedyalkov
Telerik team
answered on 05 May 2009, 11:54 AM
Hello Vikash,

I'm really sorry to read that as I know how much time and efforts we spent fighting with these bugs.

Now about the problem. I understand your problem and I've tried to find a workaround for it. I tested it and it worked fine - no hidden panes in xml, no flickering on load. I traced the Loaded event of each pane and the only Loaded events that was fired was the loaded event of the visible panes. Did you try the workaround I sent to you? If yes, please tell me in which cases it did not work properly. I might have missed something.
The reason why the foreach loop works without crashing in runtime is that we are caching the panes, before passing them to the event. Otherwise, you wouldn't be able to easily remove panes in this handler.
What pane.MenuCommand[2].Notify(Pane) does is to execute the third menu command for your pane as the user clicked it. By default this is the "Tabbed document" command, so this doesn't solve your problem at all. It just moves your pane to the document host and maybe you just don't see it.
I noticed that when the pane was in a window and it was closed, and the window was also closed, when I saved the layout and loaded it again, the window flickered, but the pane was not in it at all (its loaded event was not fired). If you mean this situation, you cannot work it around using the official version, as you cannot control the ToolWindows in this version. You can use the latest internal build and the newly added events there - PreviewWindowClose and WindowClose.
I really hope that this will solve the problem and let you continue your work. The latest internal build is available under your Client account's Downloads section.

Kind regards,
Miroslav Nedyalkov
the Telerik team

Instantly find answers to your questions on the newTelerik Support Portal.
Check out the tipsfor optimizing your support resource searches.
0
Scott
Top achievements
Rank 1
answered on 11 Mar 2010, 06:04 PM
I would think an Enumeration like RadDocking.Panes that continues to hold onto panes even though they are not in use would be a memory issue. The user can add as much panes to the dock so this enumeration will continue to grow.

Is there a best practice for making sure the docking cleans up when the pane is closed/hidden?
0
Miroslav Nedyalkov
Telerik team
answered on 11 Mar 2010, 08:31 PM
Hi Scott,

 The Docking control doesn't hold a collection with all the panes in order to enumerate them when you use the Panes property of the Docking control - it goes through all the split containers and finds all the panes that are in them recursively.

Actually when click the close button of a pane it is not closed, but hidden - it stays in the pane group that used to contain it. If you want to clean-up the hidden panes I would suggest you to remove them when they are hidden. In order to do that you could hook-up to the Close event of the Docking control and do your clean-up there.

Best wishes,
Miroslav Nedyalkov
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
Paul
Top achievements
Rank 1
answered on 25 Jan 2011, 03:31 PM
The close event of the Docking control?  Typcially, the docking control is the main shell of your app.  What if this application has been running all day opening and hiding panes in the DocumentHost?  Should I specify that my users must have 128Gb RAM 8-way servers as workstations?
0
George
Telerik team
answered on 31 Jan 2011, 09:48 AM
Hi Paul,

 
The Close event of the RadDocking controls fires when you close a RadPane. In this case, you could call RadPane.RemoveFromParent() method in order to remove(close) the RadPane. Please, make sure you don't keep any references to this pane or to its content. Otherwise, it won't be disposed.


Best wishes,
George
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
Tags
Docking
Asked by
hayula
Top achievements
Rank 1
Answers by
Miroslav Nedyalkov
Telerik team
Vikash
Top achievements
Rank 1
Scott
Top achievements
Rank 1
Paul
Top achievements
Rank 1
George
Telerik team
Share this question
or