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

GridView GroupDescriptors name not show

4 Answers 178 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Psyduck
Top achievements
Rank 5
Bronze
Bronze
Bronze
Psyduck asked on 26 Nov 2020, 02:47 AM

<telerik:RadGridView   ItemsSource  ="{Binding ResultList}"
                                     rad:GridViewSelectionUtilities.SelectedItems = "{Binding ResultItems}"
                                     Margin="10,5"
                                     GroupRenderMode ="Flat"
                                     HorizontalAlignment="Left"
                                     AutoGenerateColumns="False"
                                     ShowColumnHeaders="True"
                                     RowDetailsVisibilityMode="Visible"
                                     ShowGroupFooters="False"
                                     ShowGroupPanel="False"
                                     RowIndicatorVisibility="Collapsed" 
                                     EnableColumnVirtualization="True"
                                     EnableRowVirtualization="True"
                                     VirtualizingPanel.IsVirtualizing="True"
                                     ScrollViewer.HorizontalScrollBarVisibility ="Auto"
                                     ScrollViewer.VerticalScrollBarVisibility ="Visible"
                                     FrozenColumnsSplitterVisibility="Collapsed" 
                                     IsFilteringAllowed="False"
                                     IsReadOnly="True"
                                     AutoExpandGroups="False"
                                     ShowSearchPanel="True"
                                     SearchPanelCloseButtonVisibility="Collapsed"
                                     SelectionMode="Extended"
                                     SelectionUnit="FullRow"
                                     >
                   
                    <telerik:RadGridView.GroupHeaderTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal">
                                <CheckBox rad:GridViewGroupCheckUtilities.IsEnabled="True" IsThreeState="True" />
                            </StackPanel>
                        </DataTemplate>
                    </telerik:RadGridView.GroupHeaderTemplate>

                    <telerik:RadGridView.GroupDescriptors>
                        <telerik:GroupDescriptor Member="CategoryName"
                                                 SortDirection="Ascending">
                            <telerik:GroupDescriptor.AggregateFunctions>
                                <telerik:CountFunction />
                            </telerik:GroupDescriptor.AggregateFunctions>
                        </telerik:GroupDescriptor>
                    </telerik:RadGridView.GroupDescriptors>

.....

</telerik:RadGridView>

 

Hi. Guys.

I used the selectedItems, GroupHeaderTemplete using SDK Sample Browser provided by you.

I use Group Selection in the SDK sample list, but I want to change it to GroupDescriptors display Name, but it doesn't change.

Please check the image. Thx.

 

 

 

4 Answers, 1 is accepted

Sort by
0
Vladimir Stoyanov
Telerik team
answered on 30 Nov 2020, 10:20 AM

Hello Kim,

Thank you for the shared picture and sample code. 

When the GroupHeaderTemplate is defined, you are overriding the default look of the groups. In order to achieve what you are going for, you can display the key of the group next to the CheckBox. Here is what I have in mind:

 <telerik:RadGridView.GroupHeaderTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="{Binding Group.Key}" />
                        <CheckBox local:MyBehavior.IsEnabled="True" IsThreeState="True" Margin="5 0 0 0"/>
                    </StackPanel>
                </DataTemplate>
</telerik:RadGridView.GroupHeaderTemplate>

Do give this approach a try and let me know how it goes. 

Regards,
Vladimir Stoyanov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Psyduck
Top achievements
Rank 5
Bronze
Bronze
Bronze
answered on 01 Dec 2020, 12:49 AM

Hi. Thanks for posting the answer to my writing.

I tried but didn't get any results.

What does the binding value in the TextBlock mean? There is no Group.Key.

I have tested in many ways.

 

1. I tried putting different binding values.

ex) "{Binding ResultList.CategoryName}" But it is empty.

 

2.  When a fixed value is entered, it is displayed only as a fixed value.

ex) Text="Test Case" 

Test Case â–¡

Test Case â–¡

Test Case â–¡

Test Case â–¡

 

3. Create a new group key and bind it 

ex) Text="{Binding CategoryGroupKey}" ,         viewmodel : List<string> CategoryGroupKey = reulst.Groupby....

Also it is empty.

 

I haven't found a solution yet.

 

0
Vladimir Stoyanov
Telerik team
answered on 02 Dec 2020, 02:52 PM

Hello Kim,

Thank you for the shared picture.

The DataContext inside the GroupHeaderTemplate is a viewmodel that the RadGridView creates for each group. It contains a Group property, which in turn has a key. I have attached the GroupSelection SDK example modified to demonstrate how you can display the group's key along with the checkbox. 

Can you check it out and let me know, if it helps?

Regards,
Vladimir Stoyanov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Psyduck
Top achievements
Rank 5
Bronze
Bronze
Bronze
answered on 03 Dec 2020, 05:15 AM

Great! 

Thanks. I fully understood and applied.

As a result, the group name was also included next to the checkbox.

Thank you again. :)

Tags
GridView
Asked by
Psyduck
Top achievements
Rank 5
Bronze
Bronze
Bronze
Answers by
Vladimir Stoyanov
Telerik team
Psyduck
Top achievements
Rank 5
Bronze
Bronze
Bronze
Share this question
or