鼠标悬停在该行上时如何增加WPF DataGrid中的特定行高 [英] How to increase the particular row height in the WPF DataGrid when mouse is over that row

查看:85
本文介绍了鼠标悬停在该行上时如何增加WPF DataGrid中的特定行高的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当鼠标悬停在该行上时,我想在WPF DataGrid中将特定的行高增加到两倍,但其余行的高度不应更改。当mmouse在另一行上移动时,该行的高度应加倍,并且先前的行高度应变为正常。

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>   


推荐答案

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

这篇关于鼠标悬停在该行上时如何增加WPF DataGrid中的特定行高的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆