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. 百度「Web 前端研发部」面试过程和常见问题 可能会采用哪些方法来面试 STAR 面试法 喜欢什么样的面试者 喜欢问的问题

    http://segmentfault.com/a/1190000002498800 在他们的github上看到的,收藏一下备用.看完觉得还有很多要努力的地方. FEX 的面试过程 我们一般会有 3 ...

  2. Android Studio配置Android Annotations框架详解--说说那些坑

    我们开发过程中都需要写些findViewByid.serOnclickListener等类似的代码,虽然不费事,但是一个项目下来,工作量还是很大的.为了节省工作量,运生了很多对应的注解框架.网上的博客 ...

  3. 利用OCR识别扫描的jpg、tif文件的文字

    第一步:下载老马哥的从 office和sharepoint 提取出来的注册表和dll  http://115.com/file/dpa4qrt2 或者直接安装office和sharepoint2007 ...

  4. JAVA(五)反射机制/Annotation

    成鹏致远 | lcw.cnblog.com |2014-02-04 反射机制 1.认识Class类 在正常情况下,必须知道一个类的完整路径之后才可以实例化对象,但是在 java中也允许通过一个对象来找 ...

  5. mxnet:背景介绍

    学习的过程 使用mxnet作为教程的深度学习库,重点介绍高层抽象包gluon 双轨学习法,既教授大家从零实现,也教授大家使用gluon实现模型:前者为了理解深度学习的底层设计,后者将大家从繁琐的模型设 ...

  6. 聊聊Python中的is和==

    首先,Python中的is就是判断地址是否相等(相当于Java中的==),Python中的==就是判断数值是否相等(相当于Java中的equals). 看个简单的例子: a = [1, 2, 3] b ...

  7. git初始化本地项目并推送到git服务器

    1.创建本地项目,在项目根目录执行git init命令 git init 2.在git服务器上创建一个仓库,这里使用GitHub创建一个仓库. 3.执行git remote add origin &l ...

  8. Java知多少(40)接口和抽象类的区别

    类是对象的模板,抽象类和接口可以看做是具体的类的模板. 由于从某种角度讲,接口是一种特殊的抽象类,它们的渊源颇深,有很大的相似之处,所以在选择使用谁的问题上很容易迷糊.我们首先分析它们具有的相同点. ...

  9. 如何解决安装VMware后郑广电宽带客户端不能登录的问题?

    如何解决安装VMware后郑广电宽带客户端不能登录的问题? 问题:安装VMware后,郑广电宽带客户端不能登录,提示:“不允许代理上网”. 解决:将VMware的虚拟网卡(VMnet1和VMnet8) ...

  10. 解决highCharts导出功能汉化问题

    本文以highCharts中文网上的例子为原型,处理解决highCharts导出功能为英文的问题. 我们使用highCharts当然希望所有提示或文本都是中文的了,但是highCharts的默认语言是 ...