【问题标题】:WPF datagrid row details peek (layers)WPF 数据网格行详细信息查看(层)
【发布时间】:2011-03-06 12:04:45
【问题描述】:

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

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

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

从我在这个论坛上看到的,这不是天生支持的吗?我需要显示一个单独的窗口?

【问题讨论】:

    标签: wpf datagrid


    【解决方案1】:

    为什么不使用行的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 内容,但这应该会给您一个想法。

    【讨论】:

      猜你喜欢
      • 2019-06-06
      • 2016-11-24
      • 2012-03-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-11-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多