当鼠标悬停在 WPF DataGrid 中的特定行上时,如何增加该行的高度

发布于 2024-09-13 10:04:41 字数 766 浏览 2 评论 0原文

当鼠标悬停在该行上时,我想将 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 技术交流群。

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

发布评论

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

评论(1

酒几许 2024-09-20 10:04:41

分配 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.

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