当鼠标悬停在 WPF DataGrid 中的特定行上时,如何增加该行的高度
当鼠标悬停在该行上时,我想将 WPF DataGrid 中的特定行高度增加到两倍,但不应更改其余行的高度。当鼠标移动到另一行时,只有该行高度应加倍,并且先前的行高度应变为正常。
请让我知道如何执行此操作。
以前我有以下解决方案。但在这里,当鼠标悬停在特定行上时,行高会加倍,但会呈现该行。我不想要这个概念,我希望当特定行高增加时,剩余的行应该被下推。
<Style TargetType="{x:Type DataGridRow}">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="RenderTransform">
<Setter.Value>
<ScaleTransform ScaleX="1" ScaleY="2" />
</Setter.Value>
</Setter>
<Setter Property="RenderTransformOrigin" Value="0.5,0.5"/>
<Setter Property="Panel.ZIndex" Value="99999"/>
</Trigger>
</Style.Triggers>
I want to increase the particular row height to twice in the WPF DataGrid when mouse is over that row but the remaining rows height should not be changed. When the mmouse moves over on the another row only that row height should be double and the previuos row height should become normal.
Please let me know how to do this.
Previously i had the following solution. But here when the mouse over a particular row, the row height is doubled but the row is rendered. I don't want this concept, I want the remaning rows should be pushed down when the particular row height is increased.
<Style TargetType="{x:Type DataGridRow}">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="RenderTransform">
<Setter.Value>
<ScaleTransform ScaleX="1" ScaleY="2" />
</Setter.Value>
</Setter>
<Setter Property="RenderTransformOrigin" Value="0.5,0.5"/>
<Setter Property="Panel.ZIndex" Value="99999"/>
</Trigger>
</Style.Triggers>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
分配 LayoutTransform 而不是 RenderTransform 将导致在缩放行时重新排列同级元素。 LayoutTransform 在测量和排列之前应用,因此转换后的大小用于确定元素获得多少空间。
Assigning a LayoutTransform instead of RenderTransform will cause sibling elements to be rearranged when you scale the row. LayoutTransform is applied before measuring and arranging so the transformed size is used to determine how much space the element gets.