Hello,
I am working with version 20141.2035 and am trying to bind an UltaNumericEditor to a nullable property (NullableProperty). I am doing the following
// designer settings
myUltraNumericEditor.FormatString = "#,###,###.#######";myUltraNumericEditor.MaskDisplayMode = Infragistics.Win.UltraWinMaskedEdit.MaskMode.IncludeLiterals;myUltraNumericEditor.MaskInput = "{double:9.6}";myUltraNumericEditor.MaxValue = 1E+16D;myUltraNumericEditor.MinValue = -1E+16D;myUltraNumericEditor.Name = "ultraNumericEditorWireFxRate";myUltraNumericEditor.Nullable = true;myUltraNumericEditor.NumericType = Infragistics.Win.UltraWinEditors.NumericType.Decimal;myUltraNumericEditor.PromptChar = ' ';
//code behind
public decimal? NullableProperty {get; set;}
myUltraNumericEditor.DataBindings.Add("Value", this, "NullableProperty", false, DataSourceUpdateMode.OnPropertyChanged);
I have no problems using this binding approach when using a non nullable decimal.
Thanks in advance for any help
Hi,
Is the code you have here in the designer.cs file for the form? Or are you running it in the Form.cs itself or some other method?
I tried it out and the code you have here works fine if it's int he Form designer code. But if you take the same code and put it in Form_Load, it raises an exception.
The exception is "The specified mask is not compatible with the current value of the 'NumericType' property."
The reason for this exception appears to be that you are setting the MaskInput before you set the NumericType property. If you do this in the designer code, then the control handles this, but if you set it in your code, it won't work. The fix is very simple in that case, of course. Just set the MaskInput AFTER setting the NumericType property.
I have attached my sample here so you can check it out. In my sample, I set the MaskInput and other properties inside the designer code and it's working fine for me.
Hi Mike, thank you for the response.
Yes, all the design and layout centric stuff were all in the designer.
After running your example I'm confused, why wouldn't the setter for the bound property be called. Is this a "Two Way" binding?
I've modified your property to the following.
private void Form1_Load(object sender, EventArgs e){ this.NullableProperty = 5; this.ultraNumericEditor1.DataBindings.Add("Value", this, "NullableProperty", false, DataSourceUpdateMode.OnPropertyChanged);}private decimal? _nullableProperty;public decimal? NullableProperty { get { return _nullableProperty; } set { _nullableProperty = value; } }
given the binding you set up, i would expect a breakpoint at the set would be hit.
Your example and another example that was provided by the infragistics support team, both contained examples of binding functionality they were intending to display. Both are having this binding issue. Could there be something strange on my computer preventing these from working correctly?
thank you.
thanks in advance