Search code examples
c#wpfgridviewcomboboxselecteditem

WPF Listview/Gridview setting selected item when combobox is clicked


I'm having issues using a GridView as a ListView's View, what I want to do is fire an event when a user makes a selection from a combobox within the Gridview and pass the selected item within the event.

  • My first issue is that when the user clicks the combobox within a row, the row isnt selected (meaning the selecteditem stays null unless they click elsewhere first). Is there a clean way to do this without trying to catch mouse clicks or anything?
  • Secondly theres no selectionchangecommited event on a WPF combobox, is there a cleaner way to check if a user has manually selected an option other than checking if the combobox is enabled?

Thanks


Solution

  • I 'solved' my issue by using the WPF Toolkit grid (http://wpf.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=29117) and a series of selected items, which is probably a cleaner solution anyway. Doesn't explain the behavior of the GridView, which is to me unusual

    Original link has died, believe this to be the one https://github.com/xceedsoftware/wpftoolkit/wiki/DataGrid