Editors in a Ribbon and command support

Ribbon for WPF Forum

Posted 9 years ago by Robert Croshere
Version: 10.2.0531
Avatar
Hi,

I'm trying use a DoubleEditBox within a Ribbon. I'm using the attached RibbonControlService.Command property, but this doesn't seem to do anything. How can I get this to work (preferably just like a ribbon:TextBox, with support for IValueCommandParameter).

Thanks in advance,
Robert

Comments (4)

Posted 9 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Robert,

The DoubleEditBox does not currently support the Ribbon command model, as they are two separate products. I'm added this forum post to a TODO item we have to look into adding support, which would mostly go in a derived type in the Editors.Interop.Ribbon assembly.

You make be able to use a custom attached behavior on the DoubleEditBox, which would hook into the ValueChanging/ValueChanged and fire the Ribbon command as needed.


Actipro Software Support

Posted 9 years ago by Robert Croshere
Avatar
Ok, thanks for the reply.
In the meanwhile I guess I will use the TextBox control and restrict the input.
I have run into a problem with this though: I use the CanExecute to get the initial value for the textbox, however, whenever I type anything into the textbox, the CanExecute is executed again (again with commit as action) and the UpdatedValue gets set again to the initial value. This way the user can't make any changes to the text as it gets reset everytime a character is typed. This is the same problem as described in at the end in post http://www.actiprosoftware.com/Support/Forums/ViewForumTopic.aspx?ForumTopicID=3855. An answer to this problem is not given though. How am I supposed to use a TextBox in a ribbon with command (Execute and CanExecute) support?
Posted 9 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Robert

Yes CanExecute will likely fire as the user types. You'd probably have to track whether you've updated the value in CanExecute somehow via a flag. So do it the first time but then flag not to do it until an Execute is later called with a Commit. At that time reset your flag so the next CanExecute can update it again.


Actipro Software Support

Posted 9 years ago by Robert Croshere
Avatar
Well, I had to do more than that, as I'm using a Prism CompositeCommand which can have many commands registered with it, but only one can be active at a time. So when the focus shifts to another part of my application (I'm using the textbox exacly like it is used in the height and width boxes in the size group on the picture tools context tab used in Word), the textboxes need to reload. I was able to work around that as well, but it does seem very awkward.
Wouldn't it be much better if the CanExecute handler would have different values for its Action property depending on if the user was typing or it the value is being initially loaded? Thanks for the help though,

Regards
Robert
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.