如何在 Infragistics wingrid 中以垂直格式列出数据

发布于 2024-11-09 14:26:43 字数 1191 浏览 0 评论 0原文

通常(并且自然地),列表中的每个条目都显示在网格控件中的一行中,但在某些情况下,我需要以垂直格式(即在一列中)显示每个条目。

例如,对于一个简单的网格,如:

是否可以在 Infragistics wingrid 中将其显示为:

这样做的一个原因是每个条目的字段太多,用户认为如果它们都在同一列而不是同一行,导航会更容易。

我知道我可以手动转换原始数据源并以垂直格式构建另一个业务对象,但这感觉很尴尬,因为新的 BO 并没有真正呈现其真正含义的本质。

非常感谢任何帮助..谢谢。

Normally (and naturally), each entry in a list is presented in a row in the grid control, but there're cases when I need to show each entry in a vertical format, i.e. in a column.

For example, for a simple grid like:

Is it possible to show it in Infragistics wingrid as:

One reason of doing this is because there're too many fields for each entry and the user thinks it would be easier to navigate if they're all in the same column instead of the same row.

I know I can manually transform the original data source and build another business object in the vertical format, but it feels awkward because the new BO doesn't really present the nature of what it really means.

Any help is very much appreciated..Thanks.

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

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

发布评论

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

评论(2

洒一地阳光 2024-11-16 14:26:43

尼科是对的。 CardView 应该可以满足您在这里的需求。

请让我为您提供有关此属性的更多详细信息:

  1. 此属性确定 Band 是否处于 CardView 模式。
  2. 一旦在任何乐队上设置,该乐队的所有后代都将被隐藏。
  3. 在大多数情况下,最佳设置位置是 UltraGridInitializeLayout 事件中。

为了实现所需的外观,您可能会使用以下代码:

private void ultraGrid1_InitializeLayout(object sender, InitializeLayoutEventArgs e)
{
      //Setting the desired Band to be in a CardView mode
      e.Layout.Bands[0].CardView = true;

      //Restrict the maximum card area rows
      e.Layout.Bands[0].CardSettings.MaxCardAreaRows = 1;

      //Decide if  the caption should be shown
      e.Layout.Bands[0].CardSettings.ShowCaption = false;

      //Remove the CardSpacing so it would like closer to what you are expecting            
      e.Layout.Bands[0].Override.CardSpacing = 0;
}

有关 CardView 样式的更多一般信息,请查看 这里

Nico is right. CardView should do what you are looking for here.

Please let me provide you more details about this property:

  1. This property determines whether the Band is in CardView mode.
  2. Once set on any Band, all of the descendants of this Band will become hidden.
  3. In most cases the best place to be set would be in the InitializeLayout event of your UltraGrid.

In order to achieve the desired look you would probably use the following code:

private void ultraGrid1_InitializeLayout(object sender, InitializeLayoutEventArgs e)
{
      //Setting the desired Band to be in a CardView mode
      e.Layout.Bands[0].CardView = true;

      //Restrict the maximum card area rows
      e.Layout.Bands[0].CardSettings.MaxCardAreaRows = 1;

      //Decide if  the caption should be shown
      e.Layout.Bands[0].CardSettings.ShowCaption = false;

      //Remove the CardSpacing so it would like closer to what you are expecting            
      e.Layout.Bands[0].Override.CardSpacing = 0;
}

For more general information about the CardView style please take a look here.

血之狂魔 2024-11-16 14:26:43

您是否尝试将 CardView 属性设置为活动状态?

这应该可以解决你的问题。

Did you try to set the CardView property as active?

This should solve your problem.

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