具有特定列的RadDataGrid,C#中的聚合和分组

问题描述 投票:1回答:1

我遇到了自定义数据网格的问题,该数据网格具有特定的列,聚合和分组,但它不起作用......好吧,不是在C#中。如果在XAML中定义,分组工作率为100%,但c#的命中和未命中,大多数是错过。

聚合从未奏效。

我基本上生成PivotItems ...这是有效的,然后我用一个数据网格填充每个数据网格,其中定义了特定的列,以及分组和聚合规则。

除了聚合和分组之外,PivotItems,DataGrids和Data的总体工作都很完美。

我甚至尝试过使用XAML模板......也行不通,所以我很茫然。

有人可以提供一些关于我做错了什么的提示。 任何帮助或建议将不胜感激。

谢谢

我的代码如下:

private void BuildPivots()
{
    if (App.Categories != null)
    {
        foreach (Categories Category in App.Categories)
        {
            Home_PivotShell.Items.Add(new PivotItem
            {
                Header = Category.Name,
                Name = Category.Id,
                Content = new RadDataGrid
                {
                    AutoGenerateColumns = false,
                    UserEditMode = DataGridUserEditMode.External,
                    ItemsSource = App.DataSet.Where(x => x.CategoryId == Category.Id),
                    GroupDescriptors =
                    {
                        new PropertyGroupDescriptor() { PropertyName = "Name", DisplayContent = "Description"}
                    },
                    AggregateDescriptors =
                    {
                        new PropertyAggregateDescriptor() { PropertyName = "Column1", Function = KnownFunction.Count}
                    },
                    Columns =
                    {
                        new DataGridTextColumn() { PropertyName = "Name", Header = "Description" },
                        new DataGridTextColumn() { PropertyName = "Column1" },
                        new DataGridTextColumn() { PropertyName = "Column2" },
                        new DataGridTextColumn() { PropertyName = "Column3" },
                        new DataGridTextColumn() { PropertyName = "Column4" },
                        new DataGridTextColumn() { PropertyName = "Column5" },
                        new DataGridTextColumn() { PropertyName = "Column6" },
                        new DataGridTextColumn() { PropertyName = "Column7" },
                    }
                }
            });
        }
    }
}

DataSource(如所请求的):

注意:问题不在于数据源,我有几个数据源可供使用,它们都做同样的事情,分组在XAML上工作而不在C#上。聚合根本不起作用。

namespace MyUWPApp.DataObjects
{
    public class DataSet
    {
        public string Name { get; set; }
        public string Column1 { get; set; }
        public string Column2 { get; set; }
        public string Column3 { get; set; }
        public string Column4 { get; set; }
        public string Column5 { get; set; }
        public string Column6 { get; set; }
        public string Column7 { get; set; }
    }
}
c# datagrid uwp telerik
1个回答
0
投票

我在Telerik论坛上发布了相同内容并得到了帮助,从而为我的特定需求提供了可行的解决方案。

如果有人正在寻找类似的东西,你可以在这里找到https://www.telerik.com/forums/raddatagrid-with-specific-columns-aggregation-and-grouping-in-c的帖子

© www.soinside.com 2019 - 2024. All rights reserved.