UpdatedValue is not Setting value in ribbon

Ribbon for WPF Forum

Posted 10 years ago by David Sherwood
Version: 4.5.0487
Avatar
I have a TextBox in a Ribbon with a command. the CanExecute handler is setting UpdatedValue, but this is not changing the TextBox. Isn't this what is supposed to do? Or did I not understand the documentation?

Comments (7)

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

Yes that will work but you must also set the Handled property of the command parameter to true as well or else Ribbon won't look at your UpdatedValue.


Actipro Software Support

Posted 10 years ago by David Sherwood
Avatar
Ok, I was setting e.Handled and not the Handled in the parameter. But now that I have done this, it won't let me change the text. I even added IsReadOnly=False
Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
David,

Make sure you look at parameter.Action and see if it is ValueCommandParameterAction.Commit. See if that helps.


Actipro Software Support

Posted 10 years ago by David Sherwood
Avatar
I thought that check was for the executed not CanExecute. I added the check anyway but it made no difference.
I thing the problem is that CanExecute is called every time I type in the text box and replacing what I typed. I thought that was supposed only happen when I press enter.
Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
David,

It fires for any of the ValueCommandParameterAction types, allowing you control the option of doing previewing, etc.


Actipro Software Support

Posted 10 years ago by David Sherwood
Avatar
I’m still confused on how this works. What makes the ribbon control decide which option to pass? I observe with my TextBox that each key stroke calls CanExecute and when I press Enter, Executed is called. But Commit is always passed. I looked at your sample for FontFamily. In the CanExecute, it skips setting UpdatedValue if it is in preview mode and the Executed handler puts itself in and out of preview mode based on the action passed. But what decides what action to pass?
Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
David,

I believe only Galleries and ComboBox pass any ValueCommandParameterAction value other than Commit. They use the other values on mouse over etc. so that you can show live previews.

Textbox should only fire Executed when Enter is pressed or lost focus happens (with a text change from original text).


Actipro Software Support

The latest build of this product (v2018.1 build 0675) 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.