如何将 Silverlight RowDetailsTemplate 放置在其相应行上方?

发布于 2024-09-15 04:41:35 字数 574 浏览 1 评论 0原文

当您在 Silverlight 网格中创建 RowDetailsTemplate 时,您可以指定行详细信息的模板,该模板在选择行时直接显示在该行下方。

我的一个数据网格的详细信息在每一行之前(而不是在每一行之后)看起来要好得多。

我尝试过在 Blend 中修改模板,但当我到达模板的这一部分时最终陷入困境:

<sdk:DataGridRowsPresenter x:Name="RowsPresenter" 
 Grid.ColumnSpan="2" Grid.Row="1"/>

似乎没有 DataGridRowsPresenter 的关联模板,所以我似乎找不到如何操作我也许可以将详细信息移至该行上方。

这可能吗?

When you create a RowDetailsTemplate in a Silverlight grid you can specify a template for row details that is shown directly below the row when it is selected.

The details I have for one of my datagrids would look a lot better immediately before each individual row, rather than after it.

I've tried modifying the template in Blend, but end up getting stuck when I get to this part of the template:

<sdk:DataGridRowsPresenter x:Name="RowsPresenter" 
 Grid.ColumnSpan="2" Grid.Row="1"/>

There does not seem to be an associated template for DataGridRowsPresenter so I cannot seem to find how I might be able to move the details above the row.

Is this possible?

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

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

发布评论

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

评论(1

挽袖吟 2024-09-22 04:42:03

我的同事找到了这个解决方案。它在使用 .NET 4 的 Expression Blend 4 中工作。

创建一个包含数据网格的项目。这适用于 Silverlight 和 WPF。在数据网格上,使用“编辑其他模板”并创建 RowStyle 的副本。编辑 RowStyle,您将看到以下行的位置:

<sdk:DataGridRowHeader x:Name="RowHeader"
 sdk:DataGridFrozenGrid.IsFrozen="True" Grid.RowSpan="3"/>

 sdk:DataGridCellsPresenter x:Name="CellsPresenter" Grid.Column="1"
 sdk:DataGridFrozenGrid.IsFrozen="True"

 sdk:DataGridDetailsPresenter x:Name="DetailsPresenter" Grid.Column="1" Grid.Row="1"

DataGridCellsPresenterDataGridDetailsPresenterSystem.Windows.Controls.Primitive 中的类代码 > 命名空间。

您要做的就是互换 Cells Presenter 和 Details Presenter,保存样式,并将样式分配给 DataGrid RowStyle 属性。然后,您的详细信息将显示在行单元格元素上方。

除了 Blend 之外,我不知道还有什么方法可以获取整个行样式。

My work associate found this solution. It works in Expression Blend 4 using .NET 4

Create a project containing the datagrid. This works in Silverlight as well as WPF. On the datagrid, use "Edit Additional Templates" and create a copy of the RowStyle. Edit the RowStyle, and you'll see where the following lines are:

<sdk:DataGridRowHeader x:Name="RowHeader"
 sdk:DataGridFrozenGrid.IsFrozen="True" Grid.RowSpan="3"/>

 sdk:DataGridCellsPresenter x:Name="CellsPresenter" Grid.Column="1"
 sdk:DataGridFrozenGrid.IsFrozen="True"

 sdk:DataGridDetailsPresenter x:Name="DetailsPresenter" Grid.Column="1" Grid.Row="1"

The DataGridCellsPresenter and the DataGridDetailsPresenter are classes in the System.Windows.Controls.Primitive namespace.

What you do is interchange the Cells Presenter and the Details Presenter, save the style, and assign the style to the DataGrid RowStyle property. Your details will then appear above the row cell elements.

I don't know of a way besides Blend to get the entire Row Style.

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