Posts Tagged Hide
When dealing with software applications it is commonplace for users to have certain expectations. These expectations not only include the abilities of an application, but also include how such abilities are executed. The specific expectations that this article is focused upon directly concern those of the data grid control, and more specifically Microsoft’s implementation of such a control under the Windows Presentation Foundation (WPF) user-interface rendering sub-system for Windows-based applications.
Users have come to expect the ability to hide or show the columns of a data grid control. Such an action is typically executed by right-clicking on any of the data grid’s column headers. This results in the option to select a menu item, via a context menu, that will toggle the visibility of the column labeled on the menu item. Therefore providing this ability with access to execute its associated actions in the typical way, would be a wise and logical decision. The implementation of meeting this need should be provided through an encapsulated and reusable interface. Unfortunately, Microsoft’s implementation of the data grid control does not offer this functionally as a built-in feature and adding it has proving to be a difficult task.
In this article you will be provided with a solution that implements this functionality specifically for Microsoft’s implementation of the data grid control. This solution has proving reliable regardless of whether the data grid’s columns have been auto-generated through the data in which it represents, while still conforming to the generally accepted Model-View-ViewModel (MVVM) design pattern guidelines. This has been accomplished by utilizing WPF’s attached properties system whose means provide the ability of separate child elements to specify unique values on properties defined in a parent element; thus providing the ability to manipulate the parent element’s behavior indirectly. In this way the concepts of encapsulation and reuse have been applied.
- Access Keys AccessKeysManager Animation Arrays Attached Properties Bug Patch Button C# Casting Code Generation COM ContextMenu Controls DataGrid DataGridColumn DataGridColumnHeader Dynamic Dynamic Classes Exception Frame-based Hashtable Hide ListBox ListBoxItem ListView ListViewItem Maximize MenuItem MessageBar Minimize MVC Run-time Scope Scoping SelectAllCommand Selector Show Style Styles VSTO Window WindowCustomizer WindowHelper Windows Forms WinForms WPF XAML