Hi,
I have a gridview that consists of mix data bound columns and custom template column. The custom template column are basically a check box column and a calendar column. I used the techniques from this example to create those custom column (using the CreateCellElement)
http://www.telerik.com/community/forums/wpf/gridview/tab-navigation-in-a-grid-with-a-button-column.aspx
The check box column works fine with tabbing to/from the column. However the issue is with the Calendar column, as the tabbing doesn’t get the focus in the calendar control inside the column, and it doesn’t move away from it to move to the next column. Instead the focus moves to the next control beside the grid.
Any advice how to accomplish a smooth tab navigation between all column, and have the focus land in the inner controls when it is a custom column?
Regards
I have a gridview that consists of mix data bound columns and custom template column. The custom template column are basically a check box column and a calendar column. I used the techniques from this example to create those custom column (using the CreateCellElement)
http://www.telerik.com/community/forums/wpf/gridview/tab-navigation-in-a-grid-with-a-button-column.aspx
The check box column works fine with tabbing to/from the column. However the issue is with the Calendar column, as the tabbing doesn’t get the focus in the calendar control inside the column, and it doesn’t move away from it to move to the next column. Instead the focus moves to the next control beside the grid.
Any advice how to accomplish a smooth tab navigation between all column, and have the focus land in the inner controls when it is a custom column?
Regards
public override FrameworkElement CreateCellEditElement(GridViewCell cell, object dataItem)
{
cell.GotFocus += this.cell_GotFocus;
var picker = cell.Content as RmpDatePicker ?? new RmpDatePicker()
{
HorizontalAlignment = HorizontalAlignment.Stretch
};
this.BindingTarget = RmpDatePicker.SelectedDateProperty;
picker.SetBinding(this.BindingTarget, this.CreateValueBinding());
return picker;
}
private void cell_GotFocus(object sender, RoutedEventArgs e)
{
var picker = (sender as GridViewCell).ChildrenOfType<
RmpDatePicker
>().FirstOrDefault();
if (picker == null) return;
picker.Focus();
picker.HorizontalAlignment = HorizontalAlignment.Stretch;
}
private Binding CreateValueBinding()
{
var valueBinding = new Binding
{
Mode = BindingMode.TwoWay,
NotifyOnValidationError = true,
ValidatesOnExceptions = true,
UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
Path = new PropertyPath(this.DataMemberBinding.Path.Path)
};
return valueBinding;
}