How to check to which DataColumn a DataGridTextColumn is bound to
I would like to check to which DataColumn
a DataGridTextColumn
is bound to.
I am trying to do something like:
private void kblMeoravPrDataGrid_PreparingCellForEdit(object sender, DataGridPreparingCellForEditEventArgs e)
{
if ((e.Column as开发者_StackOverflow DataGridTextColumn).Binding.Path == "DBFieldName")
{
You should first check that the value isn't null.
var dataGridTextColumn = e.Column as DataGridTextColumn;
if (dataGridTextColumn != null) // If not null then the column is DataGridTextColumn
{
//working
}
精彩评论