Infragistics UltraGrid:如何删除第一行的默认选择

发布于 2024-07-14 12:15:36 字数 306 浏览 16 评论 0原文

我已将 UltraGrid 放在 WinForms 用户控件上。 我调整了一些设置,以便可以将网格用作只读多行选择表。 但有一个问题:默认情况下,第一行似乎被选中。

Selected.Rows 属性为空,ActiveRow 属性也为 null

因此,该行似乎已被选中,但实际上并未被选中,因此无法删除选择。

我确信 UltraGrid 上一定隐藏着一个设置来控制这种行为。 如果情况并非如此,那么也许有解决方法?

谢谢。

I have put an UltraGrid on a WinForms user control. I have tweaked some settings so I can use the grid as a read-only multi-row select table. But there's one problem: by default the first row appears to be selected.

But the Selected.Rows property is empty, and also the ActiveRow property is null.

So the row appears to be selected, but it actually isn't, making it impossible to remove the selection.

I'm sure there must be a setting hidden somewhere on the UltraGrid to control this behavior.
And if this is not the case then maybe there's a workaround?

Thanks.

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

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

发布评论

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

评论(7

毁我热情 2024-07-21 12:15:36

经过一番研究,我找到了解决方案,我将与大家分享:

myUltraGrid.DisplayLayout.Override.ActiveCellAppearance.Reset();
myUltraGrid.DisplayLayout.Override.ActiveRowAppearance.Reset();

After some more research I have found a solution, which I'll share with all of you:

myUltraGrid.DisplayLayout.Override.ActiveCellAppearance.Reset();
myUltraGrid.DisplayLayout.Override.ActiveRowAppearance.Reset();
离笑几人歌 2024-07-21 12:15:36

尝试这个:

this.ultraGrid1.SyncWithCurrencyManager = false;
this.ultraGrid1.DisplayLayout.Override.RowSelectors=DefaultableBoolean.False;

try this:

this.ultraGrid1.SyncWithCurrencyManager = false;
this.ultraGrid1.DisplayLayout.Override.RowSelectors=DefaultableBoolean.False;
昇り龍 2024-07-21 12:15:36

这帮助我抑制网格的“活动外观”:

grid.DisplayLayout.Override.ActiveAppearancesEnabled = Infragistics.Win.DefaultableBoolean.False;

如果您也不希望将行标记为选定,则必须对“选定外观”执行相同的操作:

grid.DisplayLayout.Override.SelectedAppearancesEnabled = Infragistics.Win.DefaultableBoolean.False;

This helped me in suppressing the "Active Appearance" of a grid:

grid.DisplayLayout.Override.ActiveAppearancesEnabled = Infragistics.Win.DefaultableBoolean.False;

If you also don't want a row to be marked as selected, you have to do the same for "Selected Appearance":

grid.DisplayLayout.Override.SelectedAppearancesEnabled = Infragistics.Win.DefaultableBoolean.False;
岁月苍老的讽刺 2024-07-21 12:15:36

我遇到了与您完全相同的问题,但 Gerrie Schenck 的解决方案对我不起作用。
我用了这个技巧:
MyUltraGrid.ActiveRow = MyUltraGrid.Rows[0];
MyUltraGrid.ActiveRow = null;

I have exactely the same problem you had, but Gerrie Schenck's solution don't work for me.
I used this trick:
MyUltraGrid.ActiveRow = MyUltraGrid.Rows[0];
MyUltraGrid.ActiveRow = null;

迷你仙 2024-07-21 12:15:36

区分“选定”和“活动”很重要。 网格永远不会自动选择任何行。您所看到的是 ActiveRow,它会像所选行一样突出显示。

网格的 ActiveRow 与CurrencyManager 同步,因此默认情况下网格的第一行会突出显示。 重置 ActiveRowAppearance 和 ActiveCellAppearance 将从 ActiveRow 中删除默认突出显示。

        this.ultraGrid1.DisplayLayout.Override.ActiveCellAppearance.Reset();
        this.ultraGrid1.DisplayLayout.Override.ActiveRowAppearance.Reset();

但需要注意的是,这并不能阻止该行成为活动行,只是网格不再突出显示活动行。 由于该行仍然处于活动状态(并且无法阻止这种情况),任何突出显示活动行的其他内容仍然会突出显示该行。 例如,如果您将样式库 (*.isl) 文件加载到将样式应用于 ActiveRow 的应用程序中,它仍然会显示。

如果你想更彻底地禁用活动行外观,完全忽略所有属性设置和样式库设置,可以这样做:

this.ultraGrid1.DisplayLayout.Override.ActiveAppearancesEnabled = Infragistics.Win.DefaultableBoolean.False;

注意,这个属性是在 v9.2 中添加的,旧版本中不存在。

It's important to distinguish between Selected and Active. The grid never selects any rows automatically What you are seeing is the ActiveRow, which displays with a highlight just like the selected rows.

The grid's ActiveRow is synched up with the CurrencyManager, so by default the grid's first row appears highlighted. Resetting the ActiveRowAppearance and ActiveCellAppearance will remove the default highlight from the ActiveRow.

        this.ultraGrid1.DisplayLayout.Override.ActiveCellAppearance.Reset();
        this.ultraGrid1.DisplayLayout.Override.ActiveRowAppearance.Reset();

But it's important to note that this does not prevent the row from becoming the active row, it just that the grid no longer highlights the active row. Since the row is still active (and there is no way to prevent this) anything else that highlights the active row will still highlight the row. For example if you load a Style Library (*.isl) file into your application that applies a style to the ActiveRow, it will still display.

If you want to disable the active row appearance in a more thorough way, completely ignoring all property settings and Style Library settings, you can do this:

this.ultraGrid1.DisplayLayout.Override.ActiveAppearancesEnabled = Infragistics.Win.DefaultableBoolean.False;

Note that this property was added in v9.2 and does not exist in older versions.

凉城凉梦凉人心 2024-07-21 12:15:36

不知何故,上面列出的解决方案都不适合我。 就我而言,我只是希望根本不发生激活/选择。 所以我做了以下事情。 这可能不是最好的解决方案,但它确实有效。

    private void LayoutVisulizerUltraGrid_AfterRowActivate(object sender, EventArgs e)
    {
        LayoutVisulizerUltraGrid.ActiveRow = null;
    }

Somehow none of the solutions listed above worked for me. In my case I simply wanted activation/selection not to happen at all. So I did the following. It may not be the best solution, but it works.

    private void LayoutVisulizerUltraGrid_AfterRowActivate(object sender, EventArgs e)
    {
        LayoutVisulizerUltraGrid.ActiveRow = null;
    }
想你的星星会说话 2024-07-21 12:15:36

完全禁用选定的行,然后将 ActiveRow 设置为 null 应清除选择。

grid.DisplayLayout.Override.SelectTypeRow = Infragistics.Win.UltraWinGrid.SelectType.None;

Disable selected row altogether, then setting ActiveRow to null should clear the selection.

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