I need to change the
Datagrid columns
visibility
context menu
<DataGridTextColumn Visibility="Visible" Binding="{Binding Story}" Header="Story" />
I've added an empty column as a temporary solution and removed it when showing one or more columns, I've achieved what I wanted using the click event, by looping through all the columns and set their visibility. but I'm looking for a solution using Only XAML code.
MVVM is not about eliminating code. It is about separation of concerns. And XAML is a markup language. It is perfectly fine to add code to hide/display columns of a DataGrid in the control itself or in the view.