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

Support both mouse and keyboard in GridView

1 Answer 126 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 02 Feb 2018, 03:22 PM

Hi,

I'm buidling a window that displays a list of countries by continent. It consists of two elements:

  • Combo box: displays a list of continents
  • Grid view: displays a list of countries belonging to the selected continent

These are the requirements:

  • Filter grid with combo box:
  1. Filter rows based on combo box selection
  • Keyboard support on grid:
  1. Keep focus
  2. Select first row by default
  3. Navigate through rows with key up/down and page up/down
  4. Open pop-up on Enter
  • Mouse support on grid:
  1. Open pop-up on click
  • Refresh grid:
  1. Periodically using a timer
  2. After pop-up closed

I used the following technologies:

  • C#
  • WPF
  • MVVM
  • Telerik UI for WPF
  • Caliburn.Micro

The problem I'm experiencing:

PreviewKeyDown on row not working after refresh grid.

  • HOW: The ViewModel sets a new value for the bound ItemsSource property, and resets the bound SelectedItem property if possible.
  • WHEN: Each time the grid receives new data:
  1. initially
  2. pop-up closed (after click or enter on row)
  3. after periodic refresh
  • RESULT:
  1. PreviewKeyDown on GridRow is not handled
  2. underlining of first cell disappears (I'm using the Material theme)
  3. selection style however is visible
  • WORKAROUND:
  1. use keyboard arrows to change selected row (strange: arrows don't work, enter doesn't).

I've attached two screenshots: one regular, and the other one is showing the problem.

 

You can download my Visual Studio project following this WeTransfer link.

Please let me know if you need any further information.

1 Answer, 1 is accepted

Sort by
0
Vladimir Stoyanov
Telerik team
answered on 07 Feb 2018, 09:21 AM
Hello Chris,

I already answered your question in ticket with ID: 1151599. Here is some information from the thread which could be helpful if someone else has a similar scenario.

Handling RadGridView's PreviewKeyDown event is an alternative in this case. The underline style shown in the photo is the style for the current cell of the RadGridView.

Regards,
Vladimir Stoyanov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
GridView
Asked by
Chris
Top achievements
Rank 1
Answers by
Vladimir Stoyanov
Telerik team
Share this question
or