Hi,
I use radComboBox with property IsEditable="True";
My problem is, i don't know how i can do validation, i would like to inform user, that city does not exist in the name he write is not in ListCity in my ViewModel.
In my ViewModel, i have :
In my class Person i have :
When i use, RadMaskedTextInput, i do all validation with method GetValidationError, i check property, but here i don't know how i can check the name of the city(string)...
Thanx for help, have a good day, Regards, Vincent
I use radComboBox with property IsEditable="True";
My problem is, i don't know how i can do validation, i would like to inform user, that city does not exist in the name he write is not in ListCity in my ViewModel.
<
telerik:RadComboBox
Grid.Column
=
"1"
HorizontalAlignment
=
"Stretch"
Margin
=
"5,5,0,5"
Width
=
"auto"
IsEditable
=
"True"
ItemsSource
=
"{Binding ListCity, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}"
DisplayMemberPath
=
"City"
Text
=
"{Binding Person.IdCity, ValidatesOnDataErrors=True, NotifyOnValidationError=True, Mode=TwoWay}"
SelectedValuePath
=
"IdCity"
/>
In my ViewModel, i have :
private
ObservableCollection<TableCity> _listCity;
public
ObservableCollection<TableCity> ListCity
{
get
{
return
this
._listCity; }
internal
set
{ Set<ObservableCollection<EntiteVille>>(
"TableCity"
,
ref
_listCity, value); }
}
In my class Person i have :
protected
override
void
GetValidationError(
string
propertyName,
ref
string
strErrorMsg)
{
switch
(propertyName)
{
case
"IdCity"
:
if
(
this
.IdCity==
null
) strErrorMsg =
"Ce paramètre est obligatoire"
;
break
;
When i use, RadMaskedTextInput, i do all validation with method GetValidationError, i check property, but here i don't know how i can check the name of the city(string)...
Thanx for help, have a good day, Regards, Vincent