Hello,
I am working on a gridview with a contextmenu.
For the comboboxes in the gridview I want to add an additional menuitem (beside Add/Delete etc.). In that case I want to do a search on the item thats currently selected in the combobox. I wired up the command to it which works fine, I am now stuck with getting the selected value from the combobox.
I want to use this value to show in my contextmenu, for example "Search Item X", where Item X is the name of the selected item in the combobox, I also want to pass the selected item to my command so I can do the actual search.
I created the code below, but I am getting a binding error stating that SelectedValue can not be found on the GridViewCell. How do I bind to the combobox inside the cell?
<ContextMenu x:Key="frsvGridComboContextMenuArtikelGroep" DataContext="{Binding PlacementTarget.DataContext, RelativeSource={RelativeSource Self}}"> <!-- Search menu-item--> <MenuItem CommandParameter="{Binding Parent.PlacementTarget.SelectedValue, RelativeSource={RelativeSource Self}}" Command="{Binding DataContext.SearchArtikelGroepCommand, Source={StaticResource subViewSpy}}" DataContext="{Binding}"> <MenuItem.Icon> <Image Source="/Resources.Icons;Component/16x16/search16.png"/> </MenuItem.Icon> <MenuItem.Header> <MultiBinding Converter="{StaticResource frsvSelectedValueToStringMultiValueConverter}"> <Binding> <Binding.Source> <sys:String>Filter op</sys:String> </Binding.Source> </Binding> <Binding Path="PlacementTarget.Text" RelativeSource="{RelativeSource AncestorType=ContextMenu}" /> <Binding> <Binding.Source> <sys:String>...</sys:String> </Binding.Source> </Binding> </MultiBinding> </MenuItem.Header> </MenuItem></ContextMenu>
Any help would be appreciated.
Regards,
Marcel