Unplanned
Last Updated: 09 Oct 2023 13:04 by ADMIN
Legrand
Created on: 09 Oct 2023 12:16
Category: DataGrid
Type: Bug Report
0
DataGrid: Localization for grouping panel does not apply
When typing to localize the text in the grouping panel, the localized string does not apply.
1 comment
ADMIN
Didi
Posted on: 09 Oct 2023 13:04

Solution: use the grouping panel as a separate control and apply the localization string in the label. 

 <VisualElement.Resources>
        <Color x:Key="LightGray">#F8F8F8</Color>
        <Color x:Key="Gray">#DFDFDF</Color>


        <DataTemplate x:Key="GroupingPanelItemTemplate">

            <Grid ColumnDefinitions="*, Auto">
                <Label Text="{Binding DisplayContent}"
                           Margin="10, 8, 2, 8" />
                <Button Command="{Binding RemoveCommand, Source={RelativeSource AncestorType={Type telerik:DataGridGroupingPanel}}}"
                            CommandParameter="{Binding}"
                            Grid.Column="1"
                            Text="X"
                            WidthRequest="30"
                            HeightRequest="30"/>
            </Grid>
        </DataTemplate>
        <ControlTemplate x:Key="GroupingPanelTemplate">
            <Grid RowDefinitions="Auto, *">
                <Label Text="{x:Static resources:DataGrid.DataGrid_GroupingPanelHeaderText}" TextColor="{AppThemeBinding Light=Red, Dark=Blue}"
                           Margin="11" />
                <CollectionView ItemTemplate="{Binding DataGrid.GroupingPanelItemTemplate, Source={RelativeSource AncestorType={Type telerik:DataGridGroupingPanel}}, TargetNullValue={StaticResource GroupingPanelItemTemplate}}"
                                    ItemsSource="{TemplateBinding DataGrid.GroupDescriptors}"
                                    CanReorderItems="True"
                                    Grid.Row="1">
                    <CollectionView.ItemsLayout>
                        <LinearItemsLayout Orientation="Vertical"
                                               ItemSpacing="2" />
                    </CollectionView.ItemsLayout>
                </CollectionView>
            </Grid>
        </ControlTemplate>
    </VisualElement.Resources>
    <Grid RowDefinitions="Auto,*">
        <telerik:DataGridGroupingPanel DataGrid="{Binding Source={x:Reference dataGrid}}"
                                       ControlTemplate="{StaticResource GroupingPanelTemplate}" />

        <telerik:RadDataGrid AutoGenerateColumns="True" Grid.Row="1"
                             x:Name="dataGrid" ServicePanel="{Null}" UserGroupMode="Enabled"
                         ItemsSource="{Binding Items}"/>
    </Grid>

 

 

Regards,
Didi
Progress Telerik

A brand new .NET MAUI course was just added to the Virtual Classroom. The training course is developed to help you get started with the Telerik UI for .NET MAUI components and features. It aims to put you in the shoes of an engineer who adds new features to an existing application. You can check it out at https://learn.telerik.com