开发者

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
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜