The column definitions of the DataGrid are not part of the SfDataGrid visual tree, so you can not bind SfDataGrid DataContext with GridColumn.
You can overcome this problem by defining ViewModel (DataContext) inside Resources and you can bind ViewModel to GridColumns by using StaticResource binding as in the following code example.
Here ViewModel is given as Windows Resources to access it as StaticResource for GridColumn Properties.
Another method is by using FindAncestor. In this method, ViewModel is defined as DataContext for MainWindow. You can bind MainWindow DataContext properties to GridColumns using RelativeResource. This FindAncestor is supported in WPF only.
Refer the following code example.
Here Hide property is defined in ViewModel. So you can set ancestor type as MainWindow and path as DataContext.Hide. IsHidden property value is derived from ViewModel through MainWindow DataContext.
|Article ID:||Published Date:||Last Revised Date:||Platform:||Control:||.NET Framework:||Product Version:|