UltraNumericEditor Version 18.2. Looking for a working example where the user can enter the whole percent value they want (e.g. 0.55), have 0.55% displayed in the control, but have the underlying value be 0.0055. It is rare I need post questions but I have been unable to solve this after a day of searching. I think I am close after re-purposing the IEditorDataFilter code from here ( http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.aspx?ArticleID=4877 ). This DataFilter properly sets the control's Value to 0.0055 but the control loses the displayed value. It goes blank! What am I missing? Even though I have been developing with Infragistics controls for over 10 years, I cannot articulate what a DataFilter is or how to properly use it. Perhaps there is no "built-in" way of doing this and I need to instead use the after exit edit mode event to divide by 100 and manually set the Value to 0.0055 and allow the format string to display 0.55%? Thank you!
Hello James,
My team and I have done an initial review of this thread, and before I make a recommendation, I would just like to clarify exactly the behavior you are looking to achieve, as an IEditorDataFilter may or may not be necessary depending on exactly what you wish to do.
At the moment, I am under the impression that the behavior you are looking to achieve is that the value would appear in edit mode as it does when not in edit mode. For example, if you have a percent format set up on the editor, .NET will evaluate this and automatically multiply that value by 100 for display. So, for example, the displayed value in this case will be 0.55%, but in edit mode, you will see 0.0055. I am under the impression that you still wish to see 0.55 in edit mode? Is this the case?
Please let me know if you have any other questions or concerns on this matter.
Hello Andrew,
Yes, you are correct. The user wants to both see and enter values in whole percent, so 0.55% is what they want to enter and see as a result. The underlying value should be in decimal percent for validation, saving, etc.
Thank you for confirming your requirement.
As such, I would recommend against your original idea to use an IEditorDataFilter in this case, and instead, just utilize the BeforeEnterEditMode and BeforeExitEditMode events. If you modify the Value property of the editor by multiplying and dividing (respectively) the values of the editor in these events, I believe you can achieve your requirement in this case.
I am attaching a sample project to demonstrate the above. I hope this helps you.
NumericEditorPercentHandling.zip
Thank you Andrew. It's what I suspected as stated in my post and only asked because everything I found on the web made it seem like there was an integrated solution. Best, James