I am trying to collapse the ribbonbar programmically at times in order to give more real estate to other elements in the application.
I tried setting the Expanded property to false. This does get rid of all of the buttons that were on the bar and the outline of the bar, however it leaves a space where the bar was, the panel below/under it doesn't expand to fill the space.
I tried setting the Expanded property to false. This does get rid of all of the buttons that were on the bar and the outline of the bar, however it leaves a space where the bar was, the panel below/under it doesn't expand to fill the space.
18 Answers, 1 is accepted
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 22 Dec 2010, 01:03 PM
Hello Brian,
You can set the RibbonBar to expand and collapse in the following way:
hope that helps
Richard
You can set the RibbonBar to expand and collapse in the following way:
Private
Sub
RadButton1_Click(
ByVal
sender
As
System.
Object
,
ByVal
e
As
System.EventArgs)
Handles
RadButton1.Click
Me
.RadRibbonBar1.RibbonBarElement.Expanded = (
Not
Me
.RadRibbonBar1.RibbonBarElement.Expanded)
End
Sub
hope that helps
Richard
0
Brian
Top achievements
Rank 1
answered on 22 Dec 2010, 03:57 PM
Okay, I found the issue.
It works fine when used from a button , however when used in the tab event handler (command tab selected) it does not work properly.
I figure this is because it does collapse it, but then the event finished and pops it back up again. So, is there a expansion handled flag or something that would tell it not to exand?
It works fine when used from a button , however when used in the tab event handler (command tab selected) it does not work properly.
I figure this is because it does collapse it, but then the event finished and pops it back up again. So, is there a expansion handled flag or something that would tell it not to exand?
0
Richard Slade
Top achievements
Rank 2
answered on 22 Dec 2010, 04:05 PM
Hi Brian,
I'm not quite sure what you mean. However, you can handle this event
which fires when the expanded is changed.
If you need more information, please let me know. If this has helped, please mark as answer so others can find the solution too
Thanks
Richard
I'm not quite sure what you mean. However, you can handle this event
Private
Sub
RibbonBar_ExpandedChanged(
ByVal
sender
As
Object
,
ByVal
e
As
EventArgs)
Handles
RadRibbonBar1.ExpandedStateChanged
End
Sub
If you need more information, please let me know. If this has helped, please mark as answer so others can find the solution too
Thanks
Richard
0
Brian
Top achievements
Rank 1
answered on 22 Dec 2010, 05:09 PM
In order to use that solution I would have to handle the commandtab selected event and then handle the expanded state change, which is fine.
The command tab handler would look something like this...
private
void
radRibbonBar1_CommandTabSelected(
object
sender, Telerik.WinControls.UI.CommandTabEventArgs args)
{
if
( radRibbonBar1.SelectedCommandTab.Name ==
"ribbonTab3"
)
{
radRibbonBar1.Expanded =
false
;
}
else
{
radRibbonBar1.Expanded =
true
;
}
}
And then the expanded handler would look something lieke this...
private
void
radRibbonBar1_ExpandedStateChanged(
object
sender, EventArgs e)
{
if
(ribbonTab3.IsSelected)
{
radRibbonBar1.Expanded =
false
;
}
}
since there is not an e.Handled to set to true.
However, the problem I am running into is that the ribbontab's "isSelected" does not actually display whether the tab is selected or not. In my case, tab2 is always selected and all of the other tabs are not, no matter what you click on. I tied to use radRibbonBar1.SelectedCommandTab however this is null inside of the expanded state handler.
Is there something else that I should be looking at to determine the selected tab? Or a better way to suppress the expansion of the tab when selected?
0
Richard Slade
Top achievements
Rank 2
answered on 22 Dec 2010, 05:43 PM
Hi Brian,
I'd like to try and replicarte your requirement as much as possible. Do you want to maintain the section collapsed for one tab, and open on another tab? If that's it, let me know and I'll try and mock up something for you. If I've got this wrong, just let me know and I'll do my best to help
Richard
I'd like to try and replicarte your requirement as much as possible. Do you want to maintain the section collapsed for one tab, and open on another tab? If that's it, let me know and I'll try and mock up something for you. If I've got this wrong, just let me know and I'll do my best to help
Richard
0
Brian
Top achievements
Rank 1
answered on 22 Dec 2010, 05:50 PM
I think what you said is correct.
I am trying to keep some tabs always expanded while other tabs are always collapsed.
I am trying to keep some tabs always expanded while other tabs are always collapsed.
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 22 Dec 2010, 06:31 PM
Hi Brian,
In that case, you could just handle the cick event for each RibbonTab. E.g.
Hope that helps, but let me know if you need more information
Richard
In that case, you could just handle the cick event for each RibbonTab. E.g.
Private
Sub
RibbonTab1_Click(
ByVal
sender
As
System.
Object
,
ByVal
e
As
System.EventArgs)
Handles
RibbonTab1.Click
Me
.RadRibbonBar1.RibbonBarElement.Expanded =
True
End
Sub
Private
Sub
RibbonTab2_Click(
ByVal
sender
As
System.
Object
,
ByVal
e
As
System.EventArgs)
Handles
RibbonTab2.Click
Me
.RadRibbonBar1.RibbonBarElement.Expanded =
False
End
Sub
Hope that helps, but let me know if you need more information
Richard
0
Brian
Top achievements
Rank 1
answered on 22 Dec 2010, 07:29 PM
At first glance, this looked like it worked. However when you click on it again (when already on that tab), it expands.
When run in debugger with a break point on it, it functions properly.
This means to me that there must be another asynchronous event that is expanding it after the click event when already on that tab. Maybe related to the double tap?
When run in debugger with a break point on it, it functions properly.
This means to me that there must be another asynchronous event that is expanding it after the click event when already on that tab. Maybe related to the double tap?
0
Richard Slade
Top achievements
Rank 2
answered on 23 Dec 2010, 10:38 AM
Hi Brian,
Unfortunatly, I haven't yet found a reliable way around this. What would be handy is an ExpandedStateChanging event so it could be cancelled. I'll keep having a look for you as and when I can and let you know if I find out how / if this can be done.
All the best
Richard
Unfortunatly, I haven't yet found a reliable way around this. What would be handy is an ExpandedStateChanging event so it could be cancelled. I'll keep having a look for you as and when I can and let you know if I find out how / if this can be done.
All the best
Richard
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 23 Dec 2010, 03:16 PM
Hi Brian,
Please can you try this.. from a few simple tests it seems to work fine.
Hope that helps
Richard
Please can you try this.. from a few simple tests it seems to work fine.
Private
Sub
RibbonTab1_Click(
ByVal
sender
As
System.
Object
,
ByVal
e
As
System.EventArgs)
Handles
RibbonTab1.Click
Me
.RadRibbonBar1.RibbonBarElement.Expanded =
True
End
Sub
Private
Sub
RibbonTab2_Click(
ByVal
sender
As
System.
Object
,
ByVal
e
As
System.EventArgs)
Handles
RibbonTab2.Click
Me
.RadRibbonBar1.RibbonBarElement.Expanded =
False
Me
.RadRibbonBar1.RibbonBarElement.Popup.Visible =
False
End
Sub
Hope that helps
Richard
0
Brian
Top achievements
Rank 1
answered on 23 Dec 2010, 03:54 PM
As I was testing your soltuion, I was noticing that it was flashing (expanding then collapsing). To investigate it more, I put a panel with a different background color on the form and set it's docking style to "fill", that way I could easily tell if the bar was expanding correctly or not (there was nothing else on the form I was testing with).
That is when I noticed that the panel never expanded when a tab was collapsed. It just left a blank space where the ribbon tab was. The panel expanding to me is a larger issue than the flashing of the tab because the whole point of collapsing the ribbonbar was to gain that extra space on the screen. I thought that this was working before, but with all of the testing I have been doing, I am not sure what I could have changed to have lost that.
That is when I noticed that the panel never expanded when a tab was collapsed. It just left a blank space where the ribbon tab was. The panel expanding to me is a larger issue than the flashing of the tab because the whole point of collapsing the ribbonbar was to gain that extra space on the screen. I thought that this was working before, but with all of the testing I have been doing, I am not sure what I could have changed to have lost that.
0
Richard Slade
Top achievements
Rank 2
answered on 23 Dec 2010, 04:02 PM
Hi Brian,
Can you confirm what version you are using? For reference I am using the latest Q3 2010 SP1 version. I don't seem to have that issue on mine if I understand you correctly. So you can see how it looks on mine I have created a short Jing video which is available here
Look forward to hearing back from you
Richard
Can you confirm what version you are using? For reference I am using the latest Q3 2010 SP1 version. I don't seem to have that issue on mine if I understand you correctly. So you can see how it looks on mine I have created a short Jing video which is available here
Look forward to hearing back from you
Richard
0
Brian
Top achievements
Rank 1
answered on 23 Dec 2010, 08:41 PM
I am using the newest version. I created a new form and tested and it worked fine, so... I took the form that was an issue and stripped it piece by piece down till it had nothing in it and was just like the fresh one that I made. After there was pretty much nothing left in the form I started going through the designer code. I finally found a line of code that fixed the issue.
this
.radRibbonBar1.RootElement.MinSize =
new
System.Drawing.Size(0, 155);
However, when I went back to the original form and took out that line it didn't fix it :(
0
Brian
Top achievements
Rank 1
answered on 23 Dec 2010, 09:37 PM
I found it. It was another similar setting. The pop up still flashes, but thankfully the bar went away
0
Richard Slade
Top achievements
Rank 2
answered on 23 Dec 2010, 10:41 PM
Hi Brian,
I'm glad this is ok for you now and you have this sorted as I'm now away for the Christmas period and don't have access to a development environment. Please remember to mark all helpful posts as answer so others can find the solution too.
All the best
Richard
I'm glad this is ok for you now and you have this sorted as I'm now away for the Christmas period and don't have access to a development environment. Please remember to mark all helpful posts as answer so others can find the solution too.
All the best
Richard
0
Hi guys, I am glad that you have found a solution. Richard, once again, thank you for your efforts. Your Telerik points have been updated.
If you have any other questions, do not hesitate to contact us.
Wish you happy holidays,
If you have any other questions, do not hesitate to contact us.
Wish you happy holidays,
Ivan Todorov
the Telerik team
Check out the Q1 2011 Roadmap for Telerik Controls for Windows Forms.
0
Victoria F
Top achievements
Rank 1
answered on 14 Jun 2012, 07:34 PM
Sorry guys ,
I have now the same problem Brian had.
What was this "another similar setting" that made RibbonBar collapse?
RibbonBar is so sensitive I can not find what is the property that makes it disappear.
I have now the same problem Brian had.
What was this "another similar setting" that made RibbonBar collapse?
RibbonBar is so sensitive I can not find what is the property that makes it disappear.
0
Hello Victoria,
Thank you for writing.
As you can see, the case here is not very clear and I am not sure how it relates to your case. I suggest that you open a new support ticket and provide us with the details around the problem you are experiencing. You can also attach a sample project which demonstrates your approach. This will let us investigate it and provide you with a proper answer.
I am looking forward to hearing from you.
Regards,
Ivan Todorov
the Telerik team
Thank you for writing.
As you can see, the case here is not very clear and I am not sure how it relates to your case. I suggest that you open a new support ticket and provide us with the details around the problem you are experiencing. You can also attach a sample project which demonstrates your approach. This will let us investigate it and provide you with a proper answer.
I am looking forward to hearing from you.
Regards,
Ivan Todorov
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>