We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Ribbon Button Toggle

I am trying to figure out how to use the IsToggle feature of the RibbonButton but the answer elludes me.

My questions are specifically how to programmtically tell the Toggle state of the button and how to programmatically set the Toggle state of the button.

The ButtonAdv has IsCheckable and IsChecked properties to do this. Why on earth RibbonButton went with IsToggle eludes me as well.

The doc in SplitButton on the Ribbon says the following

"In SplitButton, which is more preferable, RibbonButton or RibbonMenuItem?

In SplitButton, RibbonButton is more preferable since it has "Toggle" and "IsChecked" options. RibbonMenuItem is more applicable for Application Menus."

http://help.syncfusion.com/ug_94/User%20Interface/WPF/Tools/index.htm

But none of that information appears to be true. I appreciate any help anyone can provide for this.

Shannon


5 Replies

SM Shannon McCoy November 21, 2011 04:13 PM UTC

Update I can almost fake it by using a ButtonAdv instead of a RibbonButton but the ButtonAdv will not layout quite the same as the RibbonButton. It adds ~2 pixels at the bottom of the button regardless of my setting VerticalAligment or even binding the height to and adjoing button's height I also renders the exact same image from resource smaller than the 32x32 and smaller than the ribbonbutton next to it. It also looks like am am missing the grandient from the style manager. Would also like to know how to force the button to layout properly and stop shrining the image.

I am attaching a screen shot. Look at the Not Ready button



RibbonButtonVsButtonAdv_4ae49011.zip


KL Karthikeyan L Syncfusion Team November 22, 2011 09:01 AM UTC

Hi Shannon,

Thank you for using Syncfusion products,

The Toggle state of the RibbonButton can be set with the help of IsToggle property. If the Property is set true the RibbonButton will behave like a toggle button and IsSelected property holds the current state of the RibbonButton’s toggle state.

[XMAL]







[CS]

To set the Toggle state

RibbonButton1.IsToggle = true;

To get the current state of toggled RibbonButton

bool state=RibbonButton1.IsSelected;

Let us know if you have any other queries.

Regards,
Karthikeyan.







HK Harald Klammer February 22, 2016 03:13 PM UTC

I am binding the Button with a MVVM like

<syncfusion:RibbonButton Label="{Binding ItemHeader}" .... IsToggle="True" IsSelected="{Binding IsPressed}" Command="{Binding ClickButtonCommand}" />


The Property (tried DP and also normal getter/setter Property)  on VM-Object always has the value "false". Checked via a breakpoint in the setter of the normal property and in the Button-Command-Handler


any idea?




HK Harald Klammer February 22, 2016 03:27 PM UTC

Mode has to be set explizit to work:

IsSelected="{Binding IsPressed, Mode=TwoWay}"


RG Rajkumar Ganesamoorthy Syncfusion Team February 23, 2016 09:55 AM UTC

Hi Harald,

Yes , we have to set binding mode as TwoWay explicitly to bind IsSelected Property in RibbonButton. This will bind the value while using in MVVM pattern.

Regards,
Rajkumar G

Loader.
Live Chat Icon For mobile
Up arrow icon