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

How to use keyboard arrow keys for navigation

4 Answers 132 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
Juan
Top achievements
Rank 1
Juan asked on 11 Nov 2010, 12:27 PM
Hi!
I am using TreeListView Q2 2010. I can't find in documentation how to use keyboard arrow keys for navigation. Can you give an example ?

I also want TreeListView to input 0 in int field when its value is deleted. Because now validator shows error when no value is entered in a field.

Thanks in Advance.
Juan.

4 Answers, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 11 Nov 2010, 03:57 PM
Hi Juan,

You can use the Up / Down / Left / Right arrows to navigate in RadTreeListView. You can test this in our online demo.

As for your second question - you can subscribe to the CellValidating event and define its handler as below:

private void clubsGrid_CellValidating(object sender, GridViewCellValidatingEventArgs e)
{
    if (e.Cell.Column.Header.ToString() == "Stadium" && e.NewValue == "")
    {
        (e.Row.DataContext as Club).StadiumCapacity = 0;
        e.IsValid = true;
    }
}

Hope this helps.

Greetings,
Veselin Vasilev
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
0
Juan
Top achievements
Rank 1
answered on 12 Nov 2010, 04:17 AM
Hi Veselin,
I've seen your demo and navigition works fine. But i've forgotten to mention that I also have to made a certain cell active for editing in selected row when I use arrow keys for navigation. I am not sure which event handler should I use for it. Will it affect the selection of next row's  cell on Enter button ?

I've set breakpoints in  CellValidating event handler but they don't fire. It seems that it doesn't work.
0
Veselin Vasilev
Telerik team
answered on 17 Nov 2010, 03:52 PM
Hi Juan,

You can easily override the default behavior of the special keys like Enter. You can check this help topic which targets RadGridView, but as you probably know RadTreeListView inherits GridViewDataControl, so the approach will work there as well.

Best wishes,
Veselin Vasilev
the Telerik team
See What's New in RadControls for Silverlight in Q3 2010 on Tuesday, November 16, 2010 11:00 AM - 12:00 PM EST or 10:00 PM - 11:00 PM EST: Register here>>
0
Juan
Top achievements
Rank 1
answered on 24 Nov 2010, 04:03 AM
Hi Veselin,

It's turned out that some additional code is required to make it work.
i've added this to your code:

e.Cell.Value = 0;
TextBox tb = (TextBox)e.EditingElement;
tb.Text = "0";
e.Handled = true;

Thanks for help.
Juan

TextBox tb = (TextBox)e.EditingElement;
                    //if (tb.Text == "") 
                        tb.Text = "0";
                    e.Handled = true;
TextBox tb = (TextBox)e.EditingElement;
                    //if (tb.Text == "") 
                        tb.Text = "0";
     TextBox tb = (TextBox)e.EditingElement;
                        tb.Text = "0";
                    e.Handled = true;

Tags
TreeListView
Asked by
Juan
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Juan
Top achievements
Rank 1
Share this question
or