Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1140
Does XamGrid provide the validation features for a datepicker template column?
posted

I cannot seem to get validation to work correctly on a template datepicker column, any suggestions?

This is the property I am binding to:

[System.Runtime.Serialization.DataMemberAttribute(Name="End Date")]
public System.DateTime EndDate {
get {
return this.EndDateField;
}
set {
if ((this.EndDateField.Equals(value) != true)) {

if (value < StartDate)
throw new System.Exception("The end date must occur after the start date");

if(value.Month != StartDate.Month || value.Year != StartDate.Year)
throw new System.Exception("Occurrences may not span multiple months or years");

this.EndDateField = value;
this.RaisePropertyChanged("EndDate");
}
}
}

 

and this is the xaml for the column:

<igGrid:TemplateColumn HeaderText="End Date" Key="EndDate">
<igGrid:TemplateColumn.ItemTemplate>
<DataTemplate>
<TextBlock  Text="{Binding EndDate}"/>     
</DataTemplate>
</igGrid:TemplateColumn.ItemTemplate>
<igGrid:TemplateColumn.EditorTemplate>
<DataTemplate>
<basics:DatePicker SelectedDate="{Binding EndDate, Mode=TwoWay, ValidatesOnExceptions=True, NotifyOnValidationError=True, UpdateSourceTrigger=Explicit}" />   
</DataTemplate>
</igGrid:TemplateColumn.EditorTemplate>
</igGrid:TemplateColumn>

Parents
No Data
Reply Children