Binding Visible property of a DataGridColumn in WPF DataGrid

前端 未结 4 1195
情歌与酒
情歌与酒 2020-12-10 21:23

I cannot bind the Visible property of the WPF datagridtextcolumn to a boolean value.

My binding expression is,

{Binding Path=DataContext.IsThisColumn         


        
4条回答
  •  萌比男神i
    2020-12-10 21:40

    I worked this out.

    DataGridCOlumn is not a framework element so the FindAncestor call was failing (DataGridColumn not part of visual tree)

    Have to set source property of binding expression to a staticresource and it works fine.

提交回复
热议问题