[No0000F0]DataGrid一行Row添加ToolTip,wpf
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的更多相关文章
- WPF日积月累之文件监测与DataGrid指定Row的颜色
一.概述 关于DataGrid指定Row的颜色,我们可以使用转换器和DataGridRow的Style来实现.对于文件的检测,我们可以使用FileSystemWatcher来实现. 二.Demo Co ...
- 让easyui datagrid支持bootstrap的tooltip
让easyui datagrid支持bootstrap的tooltip 发表于 下午 1:53 by ylpro.net & 分类 Java. Easyui在1.3.3版本之前是不支持tool ...
- easyui datagrid列中使用tooltip
要实现这样一个效果:数据加载到DATAGRID中,鼠标移至某一列时,会弹出tooltip提示框. 最初的实现方法: { field: 'Reply', title: '备注', width: 220, ...
- iview 如何在表格中给操作图标添加Tooltip文字提示?
项目需要用到的iview 表格中操作项目有各种各样的图标,而各种各样的图标代表不同的操作,面对新用户可能很懵,那如何给这些图标添加Tooltip文字提示? 废话不多讲,直接看代码: <templ ...
- Extjs 在Grid单元中格添加Tooltip提示
Grid 中的单元格添加Tooltip 的效果 Ext.QuickTips.init(); //必须要… columns: [ { text: 'Name', dataIndex: 'name' }, ...
- MFC中添加ToolTip提示框
PART 1 MFC 对话框中的 Buttton添加提示 例如我们想在一个对话框中的一个button控件添加tooltip,实现的方法如下: 1. 在该对话框的类中添加一个CToolTipCtrl类型 ...
- 【全面解禁!真正的Expression Blend实战开发技巧】第七章 MVVM初体验-在DataGrid行末添加按钮
原文:[全面解禁!真正的Expression Blend实战开发技巧]第七章 MVVM初体验-在DataGrid行末添加按钮 博客更新较慢,先向各位读者说声抱歉.这一节讲解的依然是开发中经常遇到的一种 ...
- 【WPF】DataGrid的Row样式设置
引言 在与DataGrid相关的项目中,会有一个比较常见的需求.那就是在根据数据设置行的样式,例如行的背景色或者字体色.我们用到的方法有几个,下面一个个说来. 准备工作 介绍方法之前 ...
- WPF XML序列化保存数据 支持Datagrid 显示/编辑/添加/删除数据
XML序列化保存数据 using System; using System.Collections.Generic; using System.Linq; using System.Text; usi ...
随机推荐
- 基于CentOS 搭建 FTP 文件服务
系统要求: CentOS 7.2 64 位操作系统 一. 安装 VSFTPD (vsftpd 是在 Linux 上被广泛使用的 FTP 服务器,根据其[官网介绍][https://security.a ...
- SNF快速开发平台MVC-瀑布式分页组件
1. 瀑布式分页 目前已经比较流行了,以往的这种点击分页已经不能满足广大网民的需求了.像百度图片等等,网站都有滚动滚轮直接分页的功能,这样体验也确实好了不少,所以我们也决定在我们的框架内进行集成此 ...
- MacOS安装react。问题 -- npm全局包的权限问题
网上的教程有好多,在这里不一一列举,我只介绍我今天安装成功的步骤 首先,在安装react之前要先配置好node 1.安装node 在这里下载node的安装包https://nodejs.org/en/ ...
- nginx反向代理 强制https请求
upstream emove_pools { server ; check interval= rise= fall= timeout=; } #强制使用https跳转 server { listen ...
- C++11 右值引用和转移语义
新特性的目的 右值引用 (Rvalue Referene) 是 C++ 新标准 (C++11, 11 代表 2011 年 ) 中引入的新特性 , 它实现了转移语义 (Move Sementics) 和 ...
- SDL示例一:实现七段数码管的显示
[时间:2017-05] [状态:Open] [关键词:sdl2,数字,七段数码管,图形显示,示例代码] 0 引言 本文是针对我的step-into-sdl2/7LedDigit的原理介绍,有兴趣的可 ...
- 【GMT43智能液晶模块】例程四:SYSTICK定时器——定时读取触摸值
实验原理: 本实验采用系统定时器,通过简单的初始化定时20ms,每20ms读取一次触 摸值,并基于emWin的UI界面将读到的触摸值显示在界面上. 实验现象: 源代码下载链接: 链接:http://p ...
- Unsafe 学习和源码阅读
在代码中获取 Unsafe 对象的方法: // 在 AtomicInteger 里面是这么用的private static final Unsafe unsafe = Unsafe.getUnsafe ...
- JVM 内部原理(二)— 基本概念之字节码
JVM 内部原理(二)- 基本概念之字节码 介绍 版本:Java SE 7 每位使用 Java 的程序员都知道 Java 字节码在 Java 运行时(JRE - Java Runtime Enviro ...
- IP分片与重组详解
大家对IP数据包头,应该不陌生吧 分片便是与图中圈出来的两个地址有关,本文也是将主要围绕他们展开. 那我们先来了解他们的概念. 标志一个三比特字段遵循与用于控制或识别片段.他们是(按顺序,从高分以低位 ...