添加自定义工具提示DataGrid中排 [英] Add custom tooltip to row in DataGrid

查看:125
本文介绍了添加自定义工具提示DataGrid中排的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想定制我的DataGrid,以显示工具提示选定的行内,请参见下面的样机图片的什么,我想达到更好的主意。

I would like to customize my DataGrid to show a tooltip within the selected row, please see the mockup images below for a better idea of what I want to achieve.

因为它是目前 - 显示一个选定的行:

As it is at the moment - Shows a single selected row:

我想怎么 - 显示在同一行选定的,现在用的工具提示:

How I would like - Shows the same row selected, now with tooltip:


  • 我的DataGrid中采用绑定到视图模型。

  • 与WPF和放大器的工作; C#的Windows桌面。

我真的没有任何想法如何做到这一点,所以我愿意在任何建议所有

I don't really have any idea how to achieve this, so I'm open to any suggestions at all.

推荐答案

您可以使用的RowDetailsTemplate

下面是示例代码:

<DataGrid Name="grid" AutoGenerateColumns="False">
            <DataGrid.RowDetailsTemplate>
                <DataTemplate>
                    <TextBlock Background="Orange" Text="{Binding MoreInfo}" TextWrapping="Wrap"
                               HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
                </DataTemplate>
            </DataGrid.RowDetailsTemplate>
            <DataGrid.Columns>
                <DataGridTextColumn Header="ID" Binding="{Binding ID}" />
                <DataGridTextColumn Header="ID" Binding="{Binding Name}" />
                <DataGridTextColumn Header="ID" Binding="{Binding Surname}" />
            </DataGrid.Columns>
        </DataGrid>

这篇关于添加自定义工具提示DataGrid中排的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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