1.

<Window x:Class="WpfApp7.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApp7"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525" > <Grid>
<DataGrid Name="dataGrid" AutoGenerateColumns="False" CanUserAddRows="False">
<DataGrid.Columns>
<DataGridTemplateColumn Header="First Name">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding FirstName}">
<TextBlock.ToolTip>
<StackPanel>
<TextBlock Text="{Binding FirstName}"></TextBlock>
<TextBlock Text="{Binding LastName}"></TextBlock>
<TextBlock Text="{Binding EmailId}"></TextBlock>
<TextBlock Text="{Binding Contact}"></TextBlock>
</StackPanel>
</TextBlock.ToolTip>
</TextBlock>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Header="Last Name" Binding="{Binding LastName}"></DataGridTextColumn>
<DataGridTextColumn Header="Email Id" Binding="{Binding EmailId}"></DataGridTextColumn>
<DataGridTextColumn Header="Contact" Binding="{Binding Contact}"></DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
</Grid>
</Window>
namespace WpfApp7
{
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent(); ObservableCollection<Employee> empList =
new ObservableCollection<Employee>();
for (int i = ; i < ; i++)
{
Employee emp = new Employee
{
FirstName = "FirstName" + i,
LastName = "LastName" + i,
EmailId = "EmailId" + i,
Contact = "Contact" + i,
};
empList.Add(emp);
}
dataGrid.ItemsSource = empList;
}
}
public class Employee
{
public string FirstName { get; set; }
public string LastName { get; set; }
public string EmailId { get; set; }
public string Contact { get; set; }
}
}

2.

<Window x:Class="WpfApp7.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApp7"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525" > <Grid>
<DataGrid Name="grid" AutoGenerateColumns="False">
<DataGrid.RowDetailsTemplate>
<DataTemplate>
<TextBlock Background="Orange" Text="{Binding Contact}" TextWrapping="Wrap"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
</DataTemplate>
</DataGrid.RowDetailsTemplate>
<DataGrid.Columns>
<DataGridTextColumn Header="FirstName" Binding="{Binding FirstName}" />
<DataGridTextColumn Header="LastName" Binding="{Binding LastName}" />
<DataGridTextColumn Header="EmailId" Binding="{Binding EmailId}" />
</DataGrid.Columns>
</DataGrid>
</Grid>
</Window>
namespace WpfApp7
{
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent(); ObservableCollection<Employee> empList =
new ObservableCollection<Employee>();
for (int i = ; i < ; i++)
{
Employee emp = new Employee
{
FirstName = "FirstName" + i,
LastName = "LastName" + i,
EmailId = "EmailId" + i,
Contact = "Contact" + i,
};
empList.Add(emp);
}
grid.ItemsSource = empList;
}
}
public class Employee
{
public string FirstName { get; set; }
public string LastName { get; set; }
public string EmailId { get; set; }
public string Contact { get; set; }
}
}

[No0000F0]DataGrid一行Row添加ToolTip,wpf的更多相关文章

  1. WPF日积月累之文件监测与DataGrid指定Row的颜色

    一.概述 关于DataGrid指定Row的颜色,我们可以使用转换器和DataGridRow的Style来实现.对于文件的检测,我们可以使用FileSystemWatcher来实现. 二.Demo Co ...

  2. 让easyui datagrid支持bootstrap的tooltip

    让easyui datagrid支持bootstrap的tooltip 发表于 下午 1:53 by ylpro.net & 分类 Java. Easyui在1.3.3版本之前是不支持tool ...

  3. easyui datagrid列中使用tooltip

    要实现这样一个效果:数据加载到DATAGRID中,鼠标移至某一列时,会弹出tooltip提示框. 最初的实现方法: { field: 'Reply', title: '备注', width: 220, ...

  4. iview 如何在表格中给操作图标添加Tooltip文字提示?

    项目需要用到的iview 表格中操作项目有各种各样的图标,而各种各样的图标代表不同的操作,面对新用户可能很懵,那如何给这些图标添加Tooltip文字提示? 废话不多讲,直接看代码: <templ ...

  5. Extjs 在Grid单元中格添加Tooltip提示

    Grid 中的单元格添加Tooltip 的效果 Ext.QuickTips.init(); //必须要… columns: [ { text: 'Name', dataIndex: 'name' }, ...

  6. MFC中添加ToolTip提示框

    PART 1 MFC 对话框中的 Buttton添加提示 例如我们想在一个对话框中的一个button控件添加tooltip,实现的方法如下: 1. 在该对话框的类中添加一个CToolTipCtrl类型 ...

  7. 【全面解禁!真正的Expression Blend实战开发技巧】第七章 MVVM初体验-在DataGrid行末添加按钮

    原文:[全面解禁!真正的Expression Blend实战开发技巧]第七章 MVVM初体验-在DataGrid行末添加按钮 博客更新较慢,先向各位读者说声抱歉.这一节讲解的依然是开发中经常遇到的一种 ...

  8. 【WPF】DataGrid的Row样式设置

    引言      在与DataGrid相关的项目中,会有一个比较常见的需求.那就是在根据数据设置行的样式,例如行的背景色或者字体色.我们用到的方法有几个,下面一个个说来. 准备工作     介绍方法之前 ...

  9. WPF XML序列化保存数据 支持Datagrid 显示/编辑/添加/删除数据

    XML序列化保存数据 using System; using System.Collections.Generic; using System.Linq; using System.Text; usi ...

随机推荐

  1. php http请求封装

    /** * 发送HTTP请求方法,目前只支持CURL发送请求 * @param string $url 请求URL * @param array $params 请求参数 * @param strin ...

  2. 11G新特性 -- Multicolumn Statistics (Column groups)

    默认oracle会收集表中各个列的统计信息,但是会忽略列之间的关联关系.在大多情况下,优化器假设在复杂查询中的列之间是独立的.当where子句后指定了一个表的多个列条件时,优化器通常会将多个列的选择性 ...

  3. 详述socket编程之select()和poll()函数

    转自:http://www.cppblog.com/myjfm/archive/2011/10/26/159093.aspx select()函数和poll()函数均是主要用来处理多路I/O复用的情况 ...

  4. 关于NSString的@""和nil时的判断方法

    1.NSString *str = @"";该语句代表是一个空串,并且不为nil,占有内存空间 2.NSString *str = nil;该语句代表,str不指向任何对象,指针指 ...

  5. 最好的Python机器学习库

    参考链接:http://www.csdn.net/article/2015-12-10/2826435

  6. 【iCore1S 双核心板_FPGA】例程十二:基于单口RAM的ARM+FPGA数据存取实验

    实验现象: 核心代码: module single_port_ram( input CLK_12M, input WR, input RD, input CS0, inout [:]DB, input ...

  7. 关于CLOS架构的举例 网络级 设备级 FATTREE网络 网络级CLOS 以及CLOS涉及的调度算法RR

    1.概述 CLOS来自于传统电路交换概念,这个概念年代太久远,在当前数据通信网络中,内涵有所变化.本文主要谈的是实际上赋予的与原来略微有所差异的内涵. CLOS架构本身概念比较宽泛,有设备级的CLOS ...

  8. centos7 网络配置

    vi /etc/sysconfig/network-scripts/ifcfg-ens33 TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPR ...

  9. [IR] Suffix Trees and Suffix Arrays

    前缀树 匹配前缀字符串是不言自明的道理. 1. 字符串的快速检索 2. 最长公共前缀(LCP) 等等 树的压缩 后缀树 Let s=abab, a suffix tree of s is a comp ...

  10. Redis 自定义 RedisAppender 插件, 实现日志缓冲队列,集中日志输出.

    因为某些异步日志设置了即使队列满了,也不可丢弃,在并发高的时候,导致请求方法同步执行,响应变慢. 编写这个玩意,除了集中日志输出以外,还希望在高并发的时间点有缓冲作用. 之前用Kafka实现了一次入队 ...