Hide RadPanelGroupBarElements

5 posts, 1 answers
  1. Guillaume Crétot Richert
    Guillaume Crétot Richert avatar
    33 posts
    Member since:
    Oct 2008

    Posted 01 Sep 2010 Link to this post

    Hi,

    Is there a way to hide some of the GroupBarElements in a PanelBar and have the remaining GroupBarElements reposition themselves accordingly?

    For example, I can get the first 3 GroupBarElements to hide using the Visibility property, however the 4th GroupBarElement will appear where it would be if the 3 first buttons were still visible. I'd like the 4th GroupBarElement to appear on top when the previous 3 are hidden.
  2. Answer
    Stefan
    Admin
    Stefan avatar
    2890 posts

    Posted 07 Sep 2010 Link to this post

    Hi Guillaume Crétot Richert,

    Thank you for writing. 

    As you probably already know this control is obsolete and instead of it we have introduced a brand new control called RadPageView which replaces both RadPanelBar and RadTabStrip. Detailed information can be found in this blog post. Thus some issues using the obsolete controls are possible.

    Please note that my answers are targeting version Q1 2009 SP1, as you account shows that this is your current version.

    In your case regarding hiding RadPanelBarGroupElement, the only suggestion I can give you is to remove the element from the Items collection of RadPanelBar. This will remove it and will place the rest elements in the right position. In case you need the removed elements again, just keep them in variables right before removing them. Please consider the following code sample for better understanding of the instructions:
     
    RadPanelBarGroupElement element1, element2, element3;
    bool removed = false;
     
    void radPanelBar1_MouseClick(object sender, MouseEventArgs e)
    {
        if (e.Button == MouseButtons.Right)
        {
            if (removed)
            {
                radPanelBar1.Items.Add(element1);
                radPanelBar1.Items.Add(element2);
                radPanelBar1.Items.Add(element3);
                removed = false;
            }
            else
            {
                element1 = radPanelBar1.Items[0] as RadPanelBarGroupElement;
                element2 = radPanelBar1.Items[1] as RadPanelBarGroupElement;
                element3 = radPanelBar1.Items[2] as RadPanelBarGroupElement;
     
                radPanelBar1.Items.RemoveAt(0);
                radPanelBar1.Items.RemoveAt(0);
                radPanelBar1.Items.RemoveAt(0);
                removed = true;
            }
        }
    }

    I hope you find this information is helpful. If there is anything else we can help you with, do not hesitate to contact us.
     
    Sincerely yours,
    Stefan
    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
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Guillaume Crétot Richert
    Guillaume Crétot Richert avatar
    33 posts
    Member since:
    Oct 2008

    Posted 07 Sep 2010 Link to this post

    Thanks for the tips Stefan. I had tried your approach, however when inserting the controls back in the RadPanelBar, the component throws an exception (collection was modified during enumeration). I will give it another shot, but it looks like we're going to have to update at one point anyway. It is unfortunate, as we are pressed in time and have little of it to spare for updates of obsoleted controls.

    Thanks,
    Guillaume.
  5. Guillaume Crétot Richert
    Guillaume Crétot Richert avatar
    33 posts
    Member since:
    Oct 2008

    Posted 08 Sep 2010 Link to this post

    I tried your approach again, but I used the RadPanel's MouseClick event like you suggested, instead of the GroupElement.Click event like I did before. It now works perfectly. Thank you.
  6. Stefan
    Admin
    Stefan avatar
    2890 posts

    Posted 10 Sep 2010 Link to this post

    Hi Guillaume Crétot Richert,

    I am glad to hear that my response was helpful. If there is anything else I can assist you with, do not hesitate to contact me.
     
    All the best,
    Stefan
    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
Back to Top
UI for WinForms is Visual Studio 2017 Ready