是否可以更改 DataGridRowGroupHeader 控件的内容?

Is there a possibility to change content of DataGridRowGroupHeader control?

我正在使用来自 WindowsCommunityToolkit 的 DataGrid 控件,我想完全本地化该控件。

我找到了更改分组类别名称的选项 (RowGroupHeaderPropertyNameAlternative 属性),但我找不到任何更改短语来说明分组类别中有多少项的短语(字符串 "x items" 到换句话说)在同一视图中。

是否有一些控件模板或属性可以在 DataGridRowGroupHeader 中获取自定义文本?

but I can't find any to change phrase that tell how many items is in the grouped category (string "x items" to other word) in the same view.

WindowsCommunityToolkit is open source. You actually could download it and check the DataGrid source code. What you mentioned about 'string x items' is specified in its C# code. You could see this line.

if (_itemCountElement != null && this.RowGroupInfo != null && this.RowGroupInfo.CollectionViewGroup != null)
{
        _itemCountElement.Text = string.Format(
                CultureInfo.CurrentCulture,
                this.RowGroupInfo.CollectionViewGroup.GroupItems.Count == 1 ? Properties.Resources.DataGridRowGroupHeader_ItemCountSingular : Properties.Resources.DataGridRowGroupHeader_ItemCountPlural,
                this.RowGroupInfo.CollectionViewGroup.GroupItems.Count);
 }

字符串格式模板在资源文件中定义:

所以,如果你想自己本地化,可以从这一点入手。并为您的项目编译自定义 DataGrid 版本。