First you need a BooleanToVisibilityConverter
to Converter bool
to Visibility
MaterialDesignThemes has already owned one
add follow code to your xaml file
|
|
xml
|
|
xml
refer to
http://stackoverflow.com/questions/22073740/binding-visibility-for-datagridcolumn-in-wpf
DataGridTextColumn
or any other supported dataGrid columns doesn’t lie in Visual tree of DataGrid
, so the solution is:
we add
|
|
xml
to UserControl
under Grid
just like this
|
|
xml
then use it
|
|
xml
done