How to highlight selected Ribbon Button in ribbon control ?

Jul 1, 2009 at 1:15 PM

How to highlight the selected ribbon button in the Microsoft windows ribbon control ? I have a set of ribbon buttons in a Ribbon tab. When i keep the mouse over the ribbon button i can see it highlighted with yellow background but when i move the mouse away from the Ribbon button the yellow background goes off. I want to highlight the particular ribbon button that the user has clicked. In my application each ribbon button is an option for the user and i want to highlight the option that the user has currently selected.

 

Regards,

Bhupesh.

Coordinator
Jul 1, 2009 at 5:51 PM

Hi Bhupesh,

Have you tried using the RibbonToggleButton?  RibbonToggleButton is similar to the "Bold" button in the Word 2007 Ribbon - if it is clicked, it will remain "pressed" (and highlighted) until the user clicks it again.  Let me know if that solves your problem.

Thanks!
Samantha

Jul 2, 2009 at 12:20 PM

Hi Samantha,

Thanks a lot for the reply. Half the problem is solved but when i click the next ribbon toggle button it should get selected/highlighted and the ribbon button that lost focus should not remain pressed and highlighted. Its something like this left, centre, right alignment buttons in office. Only one can be selected and highlighted at a time. How can i do this ?

 

Regards,

Bhupesh.

Jul 2, 2009 at 1:02 PM

Hi samantha,

On the lost focus event of the RibbonToggleButton, i am setting the IsChecked to false. It solves the issue for me.

Do let me know if there is any better way to do it ?

Coordinator
Jul 6, 2009 at 6:08 PM

Hi Bhupesh,

That solution should work fine.  We don't have any built-in way to toggle the checked state between multiple Ribbon controls, so you would need to add some logic to do this manually and it sounds like the solution you found is working.  Note that you can use the RibbonControlGroup to get the same "grouped" look as the alignment buttons in Office, but this will only change the styling and not add any special toggle behavior.

Thanks!
Samantha