When using GroupColumns in XamGrid if the Visbility of Columns within a GroupColumn become Colapsed the GroupColumn will also become colasped. This is the behaviour expected however once the GroupColumn has become colapsed even when the Columns within that GroupColumn become Visible again the GroupColumn will never become Visible again.
Here is an example:
Xaml:
Thanks for following this up Maria. I can confirm that the solution you provided works.
To summarise for anyone else interested in how to work around this - you need to hook into ColumnVisibilityChanged event on XamGrid with the the following handler:
private void OnColumnVisibilityChanged(object sender, ColumnVisibilityChangedEventArgs e) { GroupColumn.Visibility = Visibility.Visible; }
Hi Eno,
I am just checking if my last reply was helpful for you. If you have any other questions on column visibility, please feel free to let me know.
Hello Eno,
Thank you for the detail you had provided and I am sorry for the delay. I have created a sample project where the Visibility of the Group column is changed to Visible according to the number of its visible children columns. This could be achieved by calling the ColumnVisibilityChanged method of the grid when a checkbox is checked. When this event is called I check if the group column is collapsed and if it is, its Visibility property is set to Collapsed. I hope that this will help you in resolving the issue. Please feel free to ask if you have any questions.
Hi Maria,
Here is a modification of the example above which shows the bindings being broken after the GroupColumn is automatically collapsed:
Hi,
The Visibility property of the last visible column is not changed to collapsed. Instead the GroupColumn is collapsed as it is explained in our documentation:
“If your end user tries to hide the last visible column of a GroupColumn, that particular column won’t hide, instead that GroupColumn will hide. For example, based on the above code snippet, if your end user has ProductID hidden, and then tries to hide ProductName, then the entire Product Information group will hide.”
In the attached sample the each TextColumn is bound to IsChecked property of a CheckBox but the visibility of the GroupColumn is not bound to any converter or property. When its value is changed automatically there is no functionality for setting it to visible again. If you bin dthe GroupColumn the same way the TextColumn “A” is bound, its visibility would be changed associated with the value of the IsChecked property of CheckBox “A”. This means that the binding functionality is working correctly.