I am looking for a masked editor that takes numeric values when it has focus, and should display human readable "File Size" when focus leaves the control. eg value 11111 should display 10.85KB when focus moves out of the editor.
Can anyone suggest me which Infragistics editor can help me achieve this? And, the properties I need to set for that particular control?
Sorry for being too vague about the requirement.
Thanks in Advance!
Vishal.
I did solve this issue. What i did is used UltraMaskedEdit instead of UltraNumericEditor, because I guess UltraNumericEditor can't take a Long value ( which was requirement in my case)
Then what i was missing was the FormatString property, i just set it to "##,#" and that was it.
Hope it helps someone!
Sounds like the exception is occurring in your IEditorDataFilter implementation. These exceptions are caught by the editor, so you can't see exactly what line of code they are happening on, unless you set the Visual Studio IDE to break on all run-time exceptions.
Thanks for your response!
In my case I have to enter the "FileSize" manually into the textbox, so it needs to be editable.
So what I did is implemented the IEditorDataFilter interface, and added method 'Convert'.
In Convert method i checked 'Conversion Direction'. If its OwnertoEditor and DisplayToEditor, I called the method I created, which converts entered numeric value to KB,MB,TB etc...
Now when I run this, I get an errror "Conversion from string "33.54 kb" to type 'Long' is not valid.".
What could I be missing? If you want I will post the code.
You could use the IEditorDataFilter interface to format the value in the manner you describe here when the control is not focused, by dividing the actual value by 1024 and appending a suffix like "Kb". There is a knowledge base article that demonstrates the basic approach.
You could use an UltraNumericEditor control for this, although I would think since file sizes cannot be changed directly, you would not want to allow editing. If editing is in fact disallowed, there would be no point in using that control, you would be better off using an UltraTextEditor (i.e., no masking).