I'm encountering some strange behavior in the editor controls and I'm wondering whether (a) it's a bug or (b) if I'm missing some required property settings.
If I set up a currency editor to bind its Value to a numeric property in the ViewModel (and set ValueType accordingly), the control works as expected.
<igEditors:XamCurrencyEditor ValueType="{x:Type s:Int32}" Value="{Binding TestInt}"> <igEditors:XamCurrencyEditor.ValueConstraint> <igEditors:ValueConstraint MinInclusive="0" MaxInclusive="1000000" /> </igEditors:XamCurrencyEditor.ValueConstraint> </igEditors:XamCurrencyEditor>
However, if I bind the value to a String property in the ViewModel (and set ValueType accordingly) like this:
<igEditors:XamCurrencyEditor ValueType="{x:Type s:String}" Value="{Binding TestString}"> <igEditors:XamCurrencyEditor.ValueConstraint> <igEditors:ValueConstraint MinInclusive="0" MaxInclusive="1000000" /> </igEditors:XamCurrencyEditor.ValueConstraint> </igEditors:XamCurrencyEditor>
then I get some strange results:
(1) The range checking won't accept valid values within the range, other than the original value from the ViewModel.(2) The editor content is left justified instead of right-justified.
I believe this is also happening in the XamNumericEditor too.
Please advise.
Thank you,Jim Honeycutt
Hello,
I have been looking into your questions and by default the XamCurrencyEditor accepts only numeric values. It you would like to set string values to an editor you can use XamMaskEditor. In you scenario for the XamCurrencyEditor that accepts string value, you can set the ‘ValueType’ to integer as :
ValueType="{x:Type s:Int32}"
If you need any further assistance on this matter, feel free to ask.
Thank you Yanko, I modified the ValueType to a numeric type and the editor behaved as expected.
I personally found that non-intuitive though, because I always thought the ValueType had to match the actual .NET type of the backing property. This special handling required for string-based properties wasn't apparent to me.
Could I suggest that Infragistics add a note to that effect in the documentation?
Thank you again!Jim Honeycutt
I am glad that my response was helpful. I will suggest this to be added in our documentation.
If you have any other questions on this matter, feel free to ask.