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

Hide RadPanelGroupBarElements

4 Answers 53 Views
Panelbar (obsolete as of Q2 2010)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Guillaume Crétot Richert
Top achievements
Rank 1
Guillaume Crétot Richert asked on 01 Sep 2010, 09:13 PM
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.

4 Answers, 1 is accepted

Sort by
0
Accepted
Stefan
Telerik team
answered on 07 Sep 2010, 11:54 AM
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
0
Guillaume Crétot Richert
Top achievements
Rank 1
answered on 07 Sep 2010, 01:44 PM
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.
0
Guillaume Crétot Richert
Top achievements
Rank 1
answered on 08 Sep 2010, 02:25 PM
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.
0
Stefan
Telerik team
answered on 10 Sep 2010, 01:10 PM
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
Tags
Panelbar (obsolete as of Q2 2010)
Asked by
Guillaume Crétot Richert
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Guillaume Crétot Richert
Top achievements
Rank 1
Share this question
or