【问题标题】:How to set summary footer caption row and summary values in same row in ultragrid如何在 Ultragrid 的同一行中设置摘要页脚标题行和摘要值
【发布时间】:2012-10-24 11:11:09
【问题描述】:

我正在为我的 Windows 窗体应用程序评估 UltraGrid 控件。我观察到汇总行是单独显示的,从公式获得的值显示在单独的行上。

有谁知道如何合并这两行。
例如 小计 value1 value2 value3

谢谢,
维杰

【问题讨论】:

  • 你有一张图片,你可以用你想要完成的细节来注释吗?

标签: c# infragistics ultrawingrid


【解决方案1】:

我认为这是不可能的。一个问题可能是选择将标题文本放在哪一列下,如果用户移动该列怎么办?如果标题超过一列怎么办?

一种可能的解决方法是定义一个自定义摘要并将一个空字符串设置为计算的返回值,然后使用 DisplayFormat 属性设置要用作标题的文本。

SummarySettings ss = grid.DisplayLayout.Bands[0].Summaries.Add("SummaryKeyName", 
                     SummaryType.Custom, new FakeCaptionSummary(), 
                     grid.DisplayLayout.Bands[0].Columns["ColumnUsedForCaption"],  
                     SummaryPosition.UseSummaryPositionColumn, 
                     grid.DisplayLayout.Bands[0].Columns["ColumnUsedForCaption"]);
ss.DisplayFormat = "Subtotals";

然后构建一个实现ICustomSummaryCalculator接口的类

internal class FakeCaptionSummary : ICustomSummaryCalculator
{
    public FakeCaptionSummary()
    {
         // Empty constructor
    }
    // Called at the start of the custom summary calculation
    public void BeginCustomSummary(SummarySettings summarySettings, RowsCollection rows)
    {}
    // Called for each row in band of this summary
    public void AggregateCustomSummary(SummarySettings summarySettings, UltraGridRow row)
    {}
    // Called to get the return value to put in the SummaryRpw at the specified column
    public object EndCustomSummary(SummarySettings summarySettings, RowsCollection rows)
    {
        return "";
    }
}

但请记住,此解决方案具有我在此答案开头概述的所有缺点。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-01-31
    • 1970-01-01
    • 2019-10-22
    • 1970-01-01
    • 2014-06-22
    • 1970-01-01
    • 1970-01-01
    • 2011-10-07
    相关资源
    最近更新 更多