Indeterminate checkbox

Ribbon for WPF Forum

Posted 10 years ago by Bjørnar Sundsbø - Norway
Version: 13.2.0592
Avatar

Hi,

I'm trying to use a checbox in the context of MenuItem, but the indeterminate state is not rendered. Is there a particular reason for this? It feels rather strange as a user to see it like that.

For a situation in our application, we need to be able to toggle a three-state checkbox between on and off, but display the indeterminate state. Would it be possible to introduce a Mode property to allow for this? If clicked when indeterminate, toggle to false. False to true. I have already implemented my own version of this, but it would help if we could get it out of the box.


Bjørnar Sundsbø

Comments (5)

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

Hi,

I don't believe tri-state menu items are typically done.  For instance, the WPF MenuItem doesn't support it.  The reason is that when a menu item is clicked, it closes the menu.  So users expect more of a toggle metaphor in that scenario, rather than a cycling between three options sort of metaphor.  I think that a tri-state menu item would be confusing for the user. 

Instead, I would recommend that you have a popup child menu with three options and put a checkbox next to the currently selected option.  That is more traditional UI.


Actipro Software Support

Posted 10 years ago by Bjørnar Sundsbø - Norway
Avatar

Hi,

Thank you for the explaination. It makes sense as you say. I considered using tri-state in contextmenu because of the StaysOpenOnClick option. The scenario I intended it for is a limited shortcut to other options on another screen, where the tri-state makes more sense. I don't deem further details necessary, as I buy the reasoning you give, and the intended scenario was a proof of concept.

Any thoughts on the second part about ToggleMode?


Bjørnar Sundsbø

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

Hi,

ribbon:CheckBox already has an IsThreeState property that you can set to true here.  The problem is that when it's a menu item, it uses a standard menu item template that doesn't currently have a trigger for IsChecked == null.

We will update the template for the next version to render a square glyph if IsChecked == null;


Actipro Software Support

Posted 10 years ago by Bjørnar Sundsbø - Norway
Avatar

A new template for IsChecked == null would be great, but I was thinking more along the path of "allow the checkbox to display null, but don't allow the user to toggle into that mode". i.e user can only toggle between true/false, but the application can set to null, for example to indicate the state of children.


Bjørnar Sundsbø

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

Hi,

I think you can get into that mode now.  If you have IsChecked=null but then set IsThreeState=false, I believe it won't let the user change to null.  With our updates for the next version it will render the square when IsChecked=null.


Actipro Software Support

The latest build of this product (v24.1.1) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.