Prashant Cholachagudda
Prashant Cholachagudda

Reputation: 13092

Get element from wpf datagrid

I have wpf datagrid, in one of columns, I checkboxes added in it, now the problem is how do I get "IsChecked" propoerties of it ?

Note: I have not bind that column to any datacontext, and its a Template Column

Thanks

Upvotes: 1

Views: 676

Answers (2)

Jobi Joy
Jobi Joy

Reputation: 50028

It depends on how you use the DataGrid. In a proper MVVM pattern of databinding, you might have already bind a bool property of a class to the checkbox and whenever the checkbox changes its value you will get the property change notification in your ViewModel class.

Upvotes: 1

Frank Krueger
Frank Krueger

Reputation: 70983

You need to either

  1. Record those checkboxes using variables or identifiers in XAML. Or,
  2. Iterate over the children of the grid looking for the checkboxes using some recognition function (a predicate).

Upvotes: 0

Related Questions