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

Problem in StripElement Visible/Collapsed

3 Answers 93 Views
CommandBar
This is a migrated thread and some comments may be shown as answers.
Franco
Top achievements
Rank 1
Franco asked on 18 Jan 2012, 10:23 AM
Good morning.
    I have a CommandBar with 5 strips in it. Note I don't want users to rearrange the strips, so in my real project I removed this possibility. I run the project and I see all the 5 strips, see image1.png attached file. Now I set Visibility = ElementVisibility.Collapsed for strips 2, 3 and 5. The strip disappears but strip 4 stays where it is. So I try with strip4.DesiredLocation = Pointf.Empty, and the behavior is what I want (see image2.png). When I set Visibility = ElementVisibility.Visible again (for strips 2, 3 and 5), the order of the strips is messed up, and is 1, 2, 4, 3, 5, but I wanted to get them exactly in the previous order. How can I solve this problem?

Thank you
Gianfranco

3 Answers, 1 is accepted

Sort by
0
Accepted
Stefan
Telerik team
answered on 20 Jan 2012, 05:53 PM
Hello Franco,

Thank you for writing.

You should save the commandBarStripElement4's DesiredLocation before setting it to Point.Empty. Later, when showing back the strips, set the DesiredLocation property to the saved value:

PointF saveLocation;
private void radButton1_Click(object sender, EventArgs e)
{
    commandBarStripElement2.Visibility = Telerik.WinControls.ElementVisibility.Collapsed;
    commandBarStripElement3.Visibility = Telerik.WinControls.ElementVisibility.Collapsed;
    commandBarStripElement5.Visibility = Telerik.WinControls.ElementVisibility.Collapsed;
    saveLocation = commandBarStripElement4.DesiredLocation;
    commandBarStripElement4.DesiredLocation = Point.Empty;
}
 
private void radButton2_Click(object sender, EventArgs e)
{
    commandBarStripElement2.Visibility = Telerik.WinControls.ElementVisibility.Visible;
    commandBarStripElement3.Visibility = Telerik.WinControls.ElementVisibility.Visible;
    commandBarStripElement5.Visibility = Telerik.WinControls.ElementVisibility.Visible;
    commandBarStripElement4.DesiredLocation = saveLocation;
}

I hope this helps.

Kind regards,
Stefan
the Telerik team

SP1 of Q3’11 of RadControls for WinForms is available for download (see what's new).

0
Franco
Top achievements
Rank 1
answered on 23 Jan 2012, 09:27 AM
Ok, it works! Thank you very much.
Gianfranco
0
Stefan
Telerik team
answered on 26 Jan 2012, 09:49 AM
Hello Franco,

You are welcome. If you have any other questions, do not hesitate to contact us.

All the best,
Stefan
the Telerik team

SP1 of Q3’11 of RadControls for WinForms is available for download (see what's new).

Tags
CommandBar
Asked by
Franco
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Franco
Top achievements
Rank 1
Share this question
or