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:
- Filter rows based on combo box selection
- Keyboard support on grid:
- Keep focus
- Select first row by default
- Navigate through rows with key up/down and page up/down
- Open pop-up on Enter
- Mouse support on grid:
- Open pop-up on click
- Refresh grid:
- Periodically using a timer
- 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:
- initially
- pop-up closed (after click or enter on row)
- after periodic refresh
- RESULT:
- PreviewKeyDown on GridRow is not handled
- underlining of first cell disappears (I'm using the Material theme)
- selection style however is visible
- WORKAROUND:
- 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.