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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Ribbon Button Toggle

Thread ID:

Created:

Updated:

Platform:

Replies:

101783 Nov 21,2011 03:21 PM UTC Feb 23,2016 09:55 AM UTC WPF 5
loading
Tags: Ribbon
Shannon McCoy
Asked On November 21, 2011 03:21 PM UTC

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


Shannon McCoy
Replied On 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

Karthikeyan L [Syncfusion]
Replied On 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.






Harald Klammer
Replied On 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?



Harald Klammer
Replied On February 22, 2016 03:27 PM UTC

Mode has to be set explizit to work:

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

Rajkumar Ganesamoorthy [Syncfusion]
Replied On 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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;