Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check if WPF DataRowView contains a column

Tags:

wpf

datarow

I can get the value of a column in a DataRowView using

DataRowView row;
object value = row["MyColumn"];

of course, if there is no "MyColumn" in the DataRowView, this code throws an exception.

How do I check in advance, if the row contains "MyColumn"? Sadly there is no row.Contains("MyColumn") on DataRowView.

like image 282
Sam Avatar asked Dec 12 '10 07:12

Sam


1 Answers

You can use this

dataRowView.Row.Table.Columns.Contains("MyColumn")
like image 110
Fredrik Hedblad Avatar answered Sep 23 '22 19:09

Fredrik Hedblad