Hi,
i´m testing the xamNumericEditor. I´m using MVVM. I will bind the value-property of xamNumericEdior to a property with value int32=4711 in my viewmodel. When the app is running and i delete the value in the view, in my viewmodel, the last value int32=4 is stored. Is that a bug?
best regards from Germany
Christian
If you delete the value of the XamNumericEditor, it will return null and will try to save that in the underlying object (if you have set the binding mode to TwoWay). Is your property int? or int ? In the binding, have you set the UpdateSourceTrigger property ? I tried this and when I delete the value of the editor, null is the result. If that is not the case, can you please provide a sample that reproduces the issue?
Hi Alex,
our underlying datatype is int (not nullable). Binding mode is TwoWay.We cannot use nullable types because our values simply must never be Null.
In case of an empty editor the underlying object should be set to it's default value (e.g. Numeric types should be 0).
Compare this behavior with the XamMaskedEditor which is bound to a string. The underlying string will be "" (String.Empty) if the editor is empty (not Null).
that dosen´t work!
In my ViewModel the last value is strored.
Do you have an other idea?
Best regards from germany
Hi Christian,
Do you set InvalidValueBehavior="RevertValue" for the editor somewhere in your code? You can change this to RetainValue so the default value is passed to the ViewModel instead of the last entered value.
Let me know if this fix the problem.
Hi Vlad,
where can i crate a default value?
I created a NullText="0". Than i changed InvalidValueBehavior="RetainValue". If I delete all my Values in the view, there is an "zero" in my editor. But in the ViewModel, the value is the last value i deleted, strored.
But i think we´re on the right way.
Best regards from Germany
Christian,
There is no property that is responsible for the default value and as I can see the revert value will return your last valid value and the retain value will return the last valid digit because of the PropertyChanged trigger. I suggest you to use a converter for the editor's Value instead, where you can check if the value is null and return 0. I'm attaching a sample so you can check it out.
Let me know if you have any questions.
that´s what i need!
Thank you very much!
The sample does no longer seem to apply, I can't find a property "EditorValue" to bind to.
This works for me, however:
<Style TargetType="{x:Type igEditors:ValueEditor}"> <Setter Property="ValueConstraint"> <Setter.Value> <igEditors:ValueConstraint Nullable="False" /> </Setter.Value> </Setter> <EventSetter Event="EditModeValidationError" Handler="EditModeValidationErrorHandler"/> </Style.Setters> </Style>
private void EditModeValidationErrorHandler(object sender, EditModeValidationErrorEventArgs e) { if (e.Editor.Value == null) { e.Handled = true; e.Editor.Value = 0; } }
This sounds like an issue that was recently reported and addressed in the latest hotfix for 9.2. Please try downloading the latest hotfix and see if you still get the problem.
Hi
I have some kind of performance problem, I'm working with MVVM, I have 15 xamNumericEditor controls on the screem with this constraint :
<
my:XamNumericEditor.ValueConstraint>
<my:ValueConstraint MinInclusive="0.00" MaxInclusive="100.00" />
</my:XamNumericEditor.ValueConstraint>
I retrive the values for each control from an object collection that it's shown in a xamDataGrid, but it takes a couple of seconds, however when I delete all the constraints it takes no time.
am I missing something ?