5 Answers, 1 is accepted
Generally when you are using CellTemplate and CellEditTemplate properties, you have to update these templates state (valid and invalid) manually. Can you provide me with more detailed information about your scenario and how you use these properties (a sample project will be great)? If you want some more advanced edit templates you can take a look at this blog post for additional information.
Greetings,
Nedyalko Nikolov
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Fred
<telerikGridView:RadGridView Grid.Row="2"
x:Name="ItemGrid"
ItemsSource="{Binding Items, Mode=TwoWay}"
CanUserResizeColumns="True"
AutoGenerateColumns="False"
ShowGroupPanel="False"
ColumnsWidthMode="Fill"
CanUserFreezeColumns="False"
IsReadOnly="True"
RowIndicatorVisibility="Collapsed"
VerticalGridlinesVisibility="Collapsed"
GridLinesVisibility="Horizontal"
CanUserReorderColumns="False"
CanUserInsertRows="False"
UseAlternateRowStyle="True"
IsBusy="{Binding IsLoading}"
FontWeight="{StaticResource Bold}"
FontFamily="{StaticResource Arial}"
Foreground="{StaticResource #002664}"
FontSize="{StaticResource 8pt}"
Margin="0"
VerticalAlignment="Top"
Height="330"
validations:ValidationScope.ValidationScope="{Binding CreateItemValidationScope}">
<telerikGridView:RadGridView.Columns>
<telerikGridView:GridViewDataColumn Header="Form" UniqueName="TaxFormShortDesc" TextWrapping="Wrap">
</telerikGridView:GridViewDataColumn>
<telerikGridView:GridViewDataColumn Header="Promise Date" UniqueName="PromiseDate" Width="95">
<telerikGridView:GridViewDataColumn.CellTemplate>
<DataTemplate>
<sdk:DatePicker Height="25" Width="90" HorizontalAlignment="Left" Style="{StaticResource DatePickerStyle}"
SelectedDate="{Binding PromiseDate, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnExceptions=True}"
validations:ValidationScope.ValidateBoundProperty="SelectedDate" />
</DataTemplate>
</telerikGridView:GridViewDataColumn.CellTemplate>
</telerikGridView:GridViewDataColumn>
<telerikGridView:GridViewDataColumn Header="Processing Method *" UniqueName="ProcessMethod" Width="75">
<telerikGridView:GridViewDataColumn.CellTemplate>
<DataTemplate>
<ComboBox Height="25"
Width="70"
HorizontalAlignment="Left"
ItemsSource="{Binding ProcessMethods}"
DisplayMemberPath="Description"
SelectedItem="{Binding ProcessMethod, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnExceptions=True}"
validations:ValidationScope.ValidateBoundProperty="SelectedItem"/>
</DataTemplate>
</telerikGridView:GridViewDataColumn.CellTemplate>
</telerikGridView:GridViewDataColumn>
</telerikGridView:RadGridView.Columns>
</telerikGridView:RadGridView>
I'm attaching application that demonstrates how you can show invalid state of the editing control. In order to test just select date after current date.
Unfortunately I'm not sure that MS DatePicker has such invalid state.
Kind regards,
Nedyalko Nikolov
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
I have an issue with the SelectedItem NotifyOnValidationError. I have the same code for the RadDatePicker to ensure start dates are not greater than end dates in a filter range and it works really well.
I tried to apply the same structure to the RadGridView SelectedItem to ensure that at least one item is selected. Here is the code:
SelectedItem="{Binding SelectedPrintSiteItem, Mode=TwoWay, ValidatesOnExceptions=True, NotifyOnValidationError=True}" |
And in the viewmodel:
public TblPrintSite SelectedPrintSiteItem |
{ |
get |
{ |
return _SelectedPrintSiteItem; |
} |
set |
{ |
if (value == null) |
{ |
throw new Exception("You must select at least 1 Print Site."); |
} |
else |
{ |
_SelectedPrintSiteItem = value; |
if (PropertyChanged != null) |
PropertyChanged(this, new PropertyChangedEventArgs("SelectedPrintSiteItem")); |
} |
} |
} |
The issue here is that while it does show the validation summary, it does not show a message next to the control and the IsEnabled binding on the submit button is not updated and therefore remains active:
<Button Margin="5" Content="Update Filters" Commanding:Click.Command="{Binding FilterSubmitCommand}" Width="150" |
IsEnabled="{Binding Path=HasErrors, ElementName=ValidationSummary1, Converter={StaticResource HasErrorsToIsEnabledConverter}}" /> |
Any ideas on why this could be?
Thanks for any help.
Could you please try your scenario with our latest version? I'm attaching my test project with our latest binaries for your reference. Let me know if this doesn't help.
Sincerely yours,
Nedyalko Nikolov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.