在 Infragistics Ultragrid Winforms 上显示行数

发布于 2024-12-12 20:33:04 字数 321 浏览 4 评论 0 原文

显示 UltraGrid 绑定的行数的最佳方式是什么?

我希望能够做到, this.UltraGrid.DataSource = myCustomObject;

并且,网格应显示数据以及行数。

我尝试编写一个带有超级网格和状态栏的自定义控件。 当“InitializeRow”事件被触发时,用 rowCount 更新状态栏。 这会给我我想要的东西,但是效率很低。

我尝试过其他事件,例如“InitializeLayout”、“InitializeRowsCollection”、“Enter”事件,但是当数据源更改时,这些事件不会被触发。

建议?

What is the best way to display number of rows that an UltraGrid is bound to?

I want to be able to do,
this.UltraGrid.DataSource = myCustomObject;

And, the grid should display the data along with the number of rows.

I tried to write a custom control with an ultragrid and a status bar.
Update the status bar with rowCount when "InitializeRow" event is fired.
This will give me what I want but this is very inefficient.

I have tried other events like "InitializeLayout", "InitializeRowsCollection","Enter" events but when the datasource changes these event doesn't get fired.

Suggestions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

与风相奔跑 2024-12-19 20:33:04

我找到了一种更好的方法来做到这一点,即使用 ultragrid 的 SummaryDisplayArea 功能。
http://help.infragistics.com/Help/NetAdvantage/WinForms/2011.1/CLR2.0/html/Infragistics2.Win.UltraWinGrid.v11.1~Infragistics.Win.UltraWinGrid.UltraGridOverride~SummaryDisplayArea。 html

在 InitializeLayout 事件中我有类似的东西

        e.Layout.Override.AllowRowSummaries = AllowRowSummaries.True;

        UltraGridColumn columnToSummarize = e.Layout.Bands[0].Columns[0];
        SummarySettings summary = e.Layout.Bands[0].Summaries.Add("Count", SummaryType.Count, columnToSummarize);
        summary.DisplayFormat = "Number of Rows: {0:N0}";

        e.Layout.Override.SummaryDisplayArea = SummaryDisplayAreas.BottomFixed;
        e.Layout.Override.SummaryDisplayArea |= SummaryDisplayAreas.GroupByRowsFooter;
        e.Layout.Override.SummaryDisplayArea |= SummaryDisplayAreas.InGroupByRows;

        summary.SummaryDisplayArea = SummaryDisplayAreas.BottomFixed | SummaryDisplayAreas.GroupByRowsFooter;
        e.Layout.Override.GroupBySummaryDisplayStyle = GroupBySummaryDisplayStyle.SummaryCells;

        e.Layout.Override.SummaryFooterAppearance.FontData.Bold = DefaultableBoolean.True;
        e.Layout.Override.SummaryFooterCaptionVisible = DefaultableBoolean.False;

I found a better way to do this by using SummaryDisplayArea feature of ultragrid.
http://help.infragistics.com/Help/NetAdvantage/WinForms/2011.1/CLR2.0/html/Infragistics2.Win.UltraWinGrid.v11.1~Infragistics.Win.UltraWinGrid.UltraGridOverride~SummaryDisplayArea.html

On InitializeLayout event I have something like this

        e.Layout.Override.AllowRowSummaries = AllowRowSummaries.True;

        UltraGridColumn columnToSummarize = e.Layout.Bands[0].Columns[0];
        SummarySettings summary = e.Layout.Bands[0].Summaries.Add("Count", SummaryType.Count, columnToSummarize);
        summary.DisplayFormat = "Number of Rows: {0:N0}";

        e.Layout.Override.SummaryDisplayArea = SummaryDisplayAreas.BottomFixed;
        e.Layout.Override.SummaryDisplayArea |= SummaryDisplayAreas.GroupByRowsFooter;
        e.Layout.Override.SummaryDisplayArea |= SummaryDisplayAreas.InGroupByRows;

        summary.SummaryDisplayArea = SummaryDisplayAreas.BottomFixed | SummaryDisplayAreas.GroupByRowsFooter;
        e.Layout.Override.GroupBySummaryDisplayStyle = GroupBySummaryDisplayStyle.SummaryCells;

        e.Layout.Override.SummaryFooterAppearance.FontData.Bold = DefaultableBoolean.True;
        e.Layout.Override.SummaryFooterCaptionVisible = DefaultableBoolean.False;
活泼老夫 2024-12-19 20:33:04

如果您使用 BindingSource,您可能会喜欢 绑定导航器

您可以将其从工具箱(数据选项卡)拖到表单上并设置其 BindingSource 属性。如果您愿意,您可以简单地删除添加和删除按钮,这使得它看起来像这样:

在此处输入图像描述

If you use a BindingSource you may like the BindingNavigator.

You can drag it on your form from the Toolbox (data tab) and set its BindingSource property. You can simply remove the add and delete buttons if you wish, which makes it look like this:

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文