SplitButton - disable/remove arrow when no sub items

Ribbon for WPF Forum

Posted 6 years ago by Chris Bird
Version: 13.2.0590
Platform: .NET 4.5
Environment: Windows 8 (64-bit)
Avatar

Is there any way to disable or remove the arrow from a SplitButton when there are no sub items?

If this is achievable via a template, do you have an example?

At present we achieve the desired effect by creating an instance of both a Button and a SplitButton and setting the Visibility to Collapsed for one of the controls. Unfortunately when we try and do this within a ribbon StackPanel control, the stack panel leaves a gap where the collapsed SplitButton or Button would have been. I would have thought that the stack panel would have calculated that one of the controls was not visible and rearranged its items accordingly. Is this intended behavior?

Which of these two approaches is the best way to achieve a split button without a drop down arrow, if no sub items are present?

 

Thanks.,

 

Chris.

Comments (5)

Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Chris,

If you have a SplitButton with no sub items, then the SplitButton should just be disabled.  I believe Microsoft had something in the official ribbon specs that says the SplitButton/PopupButton controls should be disabled when none of their items are enabled.

Also ribbons are designed to have a consistent set of buttons, etc. in them.  They aren't supposed to show/hide things dynamically.  Instead, they use variants to rearrange buttons based on available size.  So that is intended behavior.

I hope that helps!


Actipro Software Support

Posted 6 years ago by Chris Bird
Avatar

Ok, thanks.

Is there any way to hide the drop down arrow of the SplitButton?

Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Chris,

Sorry but that's part of the default template so you'd need to retemplate the control if you'd like to hide that.


Actipro Software Support

Posted 6 years ago by Chris Bird
Avatar

Ok, great. Do you have an example of how to template the control to do this please?

 

Thanks,

 

Chris.

Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Chris,

Your company has WPF Studio, so you are able to download our default styles/templates from the organization account.  You'd want to make a new Style for SplitButton and clone/update our default ControlTemplate in that style.  Then assign it to the button.

But per above, you really shouldn't be changing the UI of the control.  The SplitButton should just be disabled if no sub items are available.


Actipro Software Support

The latest build of this product (v2019.1 build 0681) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.