IntroductionIn this article we will see how we can hide or unhide the columns in a DataGrid.Creating WPF Application ProjectFire up Visual Studio 2008 and Create a WPF Application and name the project as HideUnhideDGInWPF. Here is the thing; we will have a DataGrid which will columns Auto Generated. We will have a Wrap Panel that will have the Check Boxes.So here we go, add a class to generate sample data. And create sample data and bind it to the DataGrid. Now in the AutoGeneratedColumns event handler add the following code to generate the CheckBoxes. Now we will work on the Hiding part for the Columns. The following code is for un hiding the columns when uncheked. That's it, we have actually done it. Run the application. And when Checked or Unchecked, it will work. Hope this article helps.
C# Corner. All contents are copyright of their authors.