RadSplitContainer cause to error

18 posts, 1 answers
  1. hayula
    hayula avatar
    8 posts
    Member since:
    Apr 2009

    Posted 06 Apr 2009 Link to this post

    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:

     

    1    <Grid> 
    2         <radDock:RadDocking x:Name="radDocking1">  
    3             <radDock:RadDocking.DocumentHostContent> 
    4  
    5                 <radDock:RadSplitContainer> 
    6                     <radDock:RadPaneGroup> 
    7                         <radDock:RadDocumentPane Title="Description" Content="Some content" /> 
    8                     </radDock:RadPaneGroup> 
    9                 </radDock:RadSplitContainer> 
    10  
    11             </radDock:RadDocking.DocumentHostContent> 
    12             <radDock:RadDocking.SplitContainers> 
    13                 <radDock:RadSplitContainer Width="150" MaxWidth="600" Name="LeftContainer" InitialPosition="DockedLeft">  
    14                     <radDock:RadPaneGroup x:Name="Group1">  
    15  
    16                         <radDock:RadPane x:Name="Pane2" Header="Toolbox">  
    17                             <Button Width="100" Height="40" Content="ghgfhfghfgh" Background="Blue"></Button> 
    18                         </radDock:RadPane> 
    19                     </radDock:RadPaneGroup> 
    20                 </radDock:RadSplitContainer> 
    21  
    22                 <radDock:RadSplitContainer Width="200" MaxWidth="679" x:Name="RightContainer" InitialPosition="DockedRight">  
    23                     <radDock:RadPaneGroup x:Name="Group2">  
    24  
    25                         <radDock:RadPane x:Name="Pane4" Header="Properties">  
    26                             <Button Width="100" Height="40" Content="ghgfhfghfgh"></Button> 
    27                         </radDock:RadPane> 
    28                     </radDock:RadPaneGroup> 
    29                 </radDock:RadSplitContainer> 
    30  
    31  
    32             </radDock:RadDocking.SplitContainers> 
    33         </radDock:RadDocking> 
    34     </Grid> 

     

  2. Answer
    Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 06 Apr 2009 Link to this post

    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.
  3. DevCraft banner
  4. Vikash
    Vikash avatar
    6 posts
    Member since:
    Mar 2009

    Posted 16 Apr 2009 Link to this post

    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.

     

     

     

     

     

     

  5. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 21 Apr 2009 Link to this post

    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.
  6. Vikash
    Vikash avatar
    6 posts
    Member since:
    Mar 2009

    Posted 23 Apr 2009 Link to this post

    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
  7. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 24 Apr 2009 Link to this post

    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.
  8. Vikash
    Vikash avatar
    6 posts
    Member since:
    Mar 2009

    Posted 24 Apr 2009 Link to this post

    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
  9. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 27 Apr 2009 Link to this post

    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.
  10. Vikash
    Vikash avatar
    6 posts
    Member since:
    Mar 2009

    Posted 27 Apr 2009 Link to this post

    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
  11. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 28 Apr 2009 Link to this post

    Hello Vikash,

    I have an idea! You could implement destroy behavior with the following code:
    Miroslav Nedyalkov
  12. Vikash
    Vikash avatar
    6 posts
    Member since:
    Mar 2009

    Posted 28 Apr 2009 Link to this post

    Miroslav,
       Where is the code?

    I guess you missed to paste that.


    Thanks & Regards,
    Vikash
  13. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 29 Apr 2009 Link to this post

    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
  14. Vikash
    Vikash avatar
    6 posts
    Member since:
    Mar 2009

    Posted 02 May 2009 Link to this post

    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



  15. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 05 May 2009 Link to this post

    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.
  16. Scott
    Scott avatar
    66 posts
    Member since:
    Nov 2009

    Posted 11 Mar 2010 Link to this post

    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?
  17. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 11 Mar 2010 Link to this post

    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.
  18. Paul
    Paul avatar
    37 posts
    Member since:
    May 2009

    Posted 25 Jan 2011 Link to this post

    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?
  19. George
    Admin
    George avatar
    1332 posts

    Posted 31 Jan 2011 Link to this post

    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>>
Back to Top
DevCraft banner