Hello
I am using XamComboEditor version 10.2.20102.1029, in a Silverlight 4.0 application under MVVM model.
XAML:
< ig:XamComboEditor Grid Row = "1" Grid Column = "1" Margin ="3" IsEditable = "True" AllowFiltering = "True" AutoComplete = "True" P:System.Windows.controls.ItemsControl.DisplayMemberPath = "Descripcion" ItemsSource = "{Binding Path = UnidadesMedidaIndependiente}" SelectedItem = "{Binding Path = UnidadMedidaIndependiente, Mode = TwoWay, NotifyOnValidationError = true, ValidatesOnExceptions = true}" / >
ViewModel: (implements InotifyPropertyChanged and INotifyDataErrorInfo).
[Required]
public Proxy.UnidadMedidaEntity UnidadMedidaIndependiente
{
get {return this.Independiente.UnidadMedida;}
set
ClearErrorFromProperty ("UnidadMedidaIndependiente");
If (value == null)
AddErrorForProperty ("UnidadMedidaIndependiente")
new ErrorInfo
P:System.Web.TraceContextRecord.IsWarning = false,
ErrorMessage = "you must select a unit of measure"
});
}
else if (this.Independiente.UnidadMedida! = value)
ValidateProperty("UnidadMedidaIndependiente",_value);
this.Independiente.UnidadMedida = value;
OnPropertyChanged ("UnidadMedidaIndependiente");
At start state the "UnidadMedidaIndependiente" property has the value null. If not selection is made and sent to save, it runs the method "base.ValidateEntity ()", which reported that the property is empty and must be marked as erroneous, but XamComboEditor control does not change the border color to red, or displays the ToolTip with the error message.
This same strategy works us with other controls, for example, the TextBox and the standard ComboBox.
Could you help us to identify the cause of this problem?
Thank you.
Jaimir G.
Hello,
If the values are initially null and must be set by the user you can add errors for each null field when the ViewModel is created then the user will have to set values in order to clear the errors.
Sincerely,
Valerie
Developer Support Engineer
Infragistics
www.infragistics.com/support
Hi , I am working on validation for XamComboEditor. Your sample is working for typing in XamComboEditor.
I have a case as this:
A form has many fields, say some textbox, 5 XamComboEditors which are mandatory items. The form is bound to a ViewModel. When use input for textbox and hit submit button to submit data, I want to redbox showing up for XamComboEditors because user input nothing for those. But actually, no redbox showing up for those XamComboEditors.
How to resolve this problem?
Nevermind - there was a problem in the validation routine. It's working correctly. Thanks.
Jim
Hi Jason,
I have the same problem and applied your templates in my app.xaml. The property bound to the combo editor has a [Required] attribute applied. When I clear the text, the red border appears, but when I select an item, the red border remains. My property setter is revalidating in both cases. I would like it to function the same as the textboxes which go back to their normal state once they have valid data.
Can you help me?
Thanks!
Great, thanks Jason, just got the case. It's working great now with your fix.
Thanks again for your help.