Hi,
When there is an exception thrown during cell validation in RadGridView edit mode, the keyboard is disabled.
Added the sample code below. Please let me know if this issue can be fixed.
When there is an exception thrown during cell validation in RadGridView edit mode, the keyboard is disabled.
Added the sample code below. Please let me know if this issue can be fixed.
// App.xaml
<
Application
x:Class
=
"SampleAppWithRadGridView.App"
StartupUri
=
"MainWindow.xaml"
DispatcherUnhandledException
=
"Application_DispatcherUnhandledException"
/>
// App.xaml.cs
private void Application_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
e.Handled = true;
MessageBox.Show(e.Exception.Message);
}
// MainWindow.xaml
<
telerik:RadGridView
Name
=
"gridView"
IsReadOnly
=
"False"
EditTriggers
=
"F2"
Width
=
"200"
></
telerik:RadGridView
>
// MainWindow.xaml.cs
public partial class MainWindow : Window
{
IList<
Student
> studentList = new List<
Student
>();
public MainWindow()
{
InitializeComponent();
InitializeStudentList();
LoadGrid();
}
void InitializeStudentList()
{
studentList.Add(new Student { FirstName = "Robert", LastName = "Williams" });
studentList.Add(new Student { FirstName = "Eric", LastName = "James" });
studentList.Add(new Student { FirstName = "Randy", LastName = "Spencer" });
gridView.ItemsSource = studentList;
}
void LoadGrid()
{
gridView.CellValidating += HandleCellValidating;
}
void HandleCellValidating(object sender, GridViewCellValidatingEventArgs e)
{
if (studentList.Any(s => s.FirstName == e.NewValue.ToString()))
{
e.Handled = true;
throw new Exception();
}
}
}