WPF数据网格行详细信息(图层)

时间:2010-06-21 19:45:53

标签: wpf datagrid

我正在寻找一种快速查看DataGrid中折叠行详细信息的方法。

当用户将鼠标悬停在行上时,光标旁边应该有一个快速查看图层,其中包含详细信息的摘要。超快是关键。

在DHTML中寻找与分层div相当的东西。不需要透明效果。

从我在这个论坛上看到的情况来看,这本身并不支持?我需要显示一个单独的窗口?

1 个答案:

答案 0 :(得分:4)

为什么不使用行的ToolTip属性?

<DataGrid Name="_grid">
    <DataGrid.RowDetailsTemplate>
        <DataTemplate>
            <TextBlock Text="{Binding Item3}" />
        </DataTemplate>
    </DataGrid.RowDetailsTemplate>
    <DataGrid.RowStyle>
        <Style TargetType="DataGridRow">
            <Setter Property="ToolTip">
                <Setter.Value>
                    <TextBlock Text="{Binding Item3}" />
                </Setter.Value>
            </Setter>
        </Style>
    </DataGrid.RowStyle>
</DataGrid>

...其中Item3是您要显示的属性(我使用了一个简单的元组作为ItemsSource)。你当然可能会有更复杂的DataTemplateToolTip内容,但这应该会给你一个想法。

相关问题