This is a migrated thread and some comments may be shown as answers.

Tab navigation on gridview with custom column

1 Answer 99 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Perlom
Top achievements
Rank 1
Perlom asked on 24 Apr 2012, 01:36 AM
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

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;
}


1 Answer, 1 is accepted

Sort by
0
Nedyalko Nikolov
Telerik team
answered on 24 Apr 2012, 12:15 PM
Hi,

I've tried to reproduce the issue (replacing RmpDatePicker with RadDatePicker, since I do not have RmpDatePicker), but with RadDatePicker I can only get StackOverflowException.
Could you please send me a sample project which I can debug on my side in order to see what is going on?

Kind regards,
Nedyalko Nikolov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
GridView
Asked by
Perlom
Top achievements
Rank 1
Answers by
Nedyalko Nikolov
Telerik team
Share this question
or