This is a migrated thread and some comments may be shown as answers.

Hide the grouped column on start

6 Answers 620 Views
GridView
This is a migrated thread and some comments may be shown as answers.
J
Top achievements
Rank 1
J asked on 21 Aug 2018, 11:47 AM

I'm using the GroupDescriptors property in XAML to define the grid to group rows. I.e. the rows are grouped using one column.

Why is the grouped column still visible when I start the application? When I ungroup and the group again using mouse, the column is then hidden. Not very consistent. Is this a bug or am I missing a property here?

You can test this issues with your SDK Samples Browser application. Just open the GridView->Group Selection example in Visual Studio, set ShowColumnWhenGrouped property to false for the first GridViewDataColumn object, and run the example. For simplicity, you may also want to comment out the second GroupDescriptor object in the GroupDescriptors collection. I.e. use just one column to group like I do.

6 Answers, 1 is accepted

Sort by
0
J
Top achievements
Rank 1
answered on 21 Aug 2018, 12:35 PM
You can also drag the first column to the group area when you start the application. Is this normal? I mean, grouping again with the same column?
0
J
Top achievements
Rank 1
answered on 21 Aug 2018, 01:04 PM

I did some digging around and it looks like GroupDescriptor isn't working correctly.

I created my own class that derives from RadGridView class. I had to use ColumnGroupDescriptor class and check in RadGridView.Columns.CollectionChanged event handler when to column count is 2 (the first column is the indexer column or whatever) and then add new ColumnGroupDescriptor object to the GroupDescriptors collection. ColumnGroupDescriptor does not have Member property, but it has Column property. That's why the above.

Anyways, this surely isn't the recommended way to handle the situation. It's even harder to use the ColumnGroupDescriptor approach in XAML.

Am I doing something wrong with the GroupDescriptor approach, or is this a bug?

0
J
Top achievements
Rank 1
answered on 21 Aug 2018, 01:23 PM

Also, not sure if this a bug or a feature, but if you define a style for GridViewDataColumn (i.e. ShowColumnWhenGrouped = False), and put it in RadGridView's Resources, the Resources element has to be before the Columns element.

I.e. the order matters. Not 100% if this is how XAML is parsed by the system, but FYI at least.

0
J
Top achievements
Rank 1
answered on 21 Aug 2018, 02:21 PM
Also, if I set GroupDescriptor.SortDirection in RadGridView.Grouped event handler, I cannot change the group sorting in UI with mouse. I.e. clicking the group box in the group area to sort the rows.
0
J
Top achievements
Rank 1
answered on 21 Aug 2018, 05:36 PM

[quote]J said:Also, if I set GroupDescriptor.SortDirection in RadGridView.Grouped event handler, I cannot change the group sorting in UI with mouse. I.e. clicking the group box in the group area to sort the rows.[/quote]

Ok, scratch that. Just realized that you can check the value of e.Action. I.e. I can now change the the sort order nicely, but the original issues still stands.

0
Vladimir Stoyanov
Telerik team
answered on 24 Aug 2018, 09:44 AM
Hello J,

Indeed in order for the ShowColumnWhenGrouped property to be reflected in the UI, you can use a ColumnGroupDescriptor. You can check out the Column ShowColumnWhenGrouped thread in our forum where a similar topic was discussed.

Additionally, defining a ColumnGroupDescriptor in xaml isn't hard at all. Can you check out the Programmatic Grouping article in our documentation which demonstrates how you can achieve this?

On a side note, please do keep in mind that it is not recommended to define styles targeting RadGridView columns since they are not visual elements and this could lead to potential issues.

I hope you find this helpful.

Regards,
Vladimir Stoyanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
GridView
Asked by
J
Top achievements
Rank 1
Answers by
J
Top achievements
Rank 1
Vladimir Stoyanov
Telerik team
Share this question
or