Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
475
XamGrid Row Selection
posted

Hi!

Is there a way to select a row in the XamGrid matching the keyboard entry to the value of a certain column?

Example my XamGrid has the following:

Name      Age

Erika        20

Fder        23 

Rich        24

Edmar    25

Say I chose the 'Name' column...if I type in 'Ri' it will highlight the 3rd row, which is Rich. Then if I typed in 'E' it will go to the first row -- Erika. It will be like how it is when listing folders and files in Windows where it highlights the first instance with the letters being typed (matched by folder or file name).

Thanks!

Parents
No Data
Reply
  • 20
    Offline posted

    Hello Erika,

    I suggestion that using ScrollCellIntoView and SelectedRows.
    I created a simple sample application.
    In the sample, there are textbox.If you input text,the corresponding line is selected from name column.

    IEnumerable<Row> result = xamGrid.Rows.Where(row => ((Person)row.Data).Name.Contains(xamText.Text));
    if(result.Count() > 0)
    {
        xamGrid.SelectionSettings.SelectedRows.Clear();
        foreach (Row row in result.ToArray())
        {
            xamGrid.SelectionSettings.SelectedRows.Add(row);
        }
        xamGrid.ScrollCellIntoView(result.ToArray()[0].Cells[0]);
    }
    

    I hope this will help.

    6138.Sample.zip

    Best Regards

Children