6 Replies
What/when do you mean? Presumably you're binding your DataGrid to something?
I want to put the id from the selected string into a variable, but I don't know how to do it
DataGrid has a SelectedItem property, and you can create a Binding for that so you can access whatever's selected
Can you give an example?
<DataGrid ItemsSource="{Binding CollectionOfSomethings}" SelectedItem="{Binding SelectedSomething, Mode=TwoWay}" >
Then you can access whatever row is currently selected through SelectedSomething
, and get SelectedSomething.Id
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.