Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Get SelectedValue of combobox in SelectedRow/Item of Datagrid

$
0
0

Hi there,

I have a datagrid that is bound to a custom list. Each row has a button and a combobox. In the click event of the button I wish to determine what value is selected in the combobox of the same row:

<DataGrid x:Name="myDataGrid"><DataGrid.Columns>
        ...<DataGridTemplateColumn><DataGridTemplateColumn.CellTemplate><DataTemplate><ComboBox x:Name="comboboxAction" /></DataTemplate></DataGridTemplateColumn.CellTemplate></DataGridTemplateColumn><DataGridTemplateColumn Header="Action"><DataGridTemplateColumn.CellTemplate><DataTemplate><Button x:Name="buttonAction">Submit</Button></DataTemplate></DataGridTemplateColumn.CellTemplate></DataGridTemplateColumn></DataGrid.Columns></DataGrid>

So when the user clicks "Submit" I want it to determine which item in the bound list is selected (which I can do by casting the SelectedItem), then determine what action has been selected in the combobox for that particular item and action it.

Thanks,

Jib


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>