WPF 改变Datagrid的选中行的颜色
主要通过设置DataGrid的RowStyle和CellStyle即可。
<Style TargetType="DataGridRow" x:Key="gridRowStyle">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Background" Value="LightGray"/>
</Trigger>
</Style.Triggers>
</Style> <Style TargetType="DataGridCell" x:Key="gridCellStyle">
<!--文字居中-->
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DataGridCell}">
<Grid Background="{TemplateBinding Background}">
<ContentPresenter HorizontalAlignment="Center" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<!--被选中时,背景色改变-->
<Style.Triggers>
<Trigger Property="DataGridCell.IsSelected" Value="True">
<Setter Property="Background" Value="Gray" />
</Trigger>
</Style.Triggers>
</Style>
<DataGrid ScrollViewer.CanContentScroll="False" AutoGenerateColumns="False" CanUserAddRows="False"
CellStyle="{StaticResource gridCellStyle}"
RowStyle="{StaticResource gridRowStyle}" />
WPF 改变Datagrid的选中行的颜色的更多相关文章
- listview改变选中行字体颜色
[android]listview改变选中行字体颜色 目标:选中item,其字体设置为#3197FF,未选中的,其字体为#FFFFFF 与listvew设置选中行item背景图片一样,使用select ...
- easyui datagrid 禁止选中行 EF的增删改查(转载) C# 获取用户IP地址(转载) MVC EF 执行SQL语句(转载) 在EF中执行SQL语句(转载) EF中使用SQL语句或存储过程 .net MVC使用Session验证用户登录 PowerDesigner 参照完整性约束(转载)
easyui datagrid 禁止选中行 没有找到可以直接禁止的属性,但是找到两个间接禁止的方式. 方式一: //onClickRow: function (rowIndex, rowData) ...
- DEV GridControl.TableView FocusedRow选中行背景颜色
上次修改了TableView.RowStyle,导致了一个问题:覆盖了GridControl默认的选中行颜色. 于是需要重写选中行的颜色. 刚开始的想法是: <dxg:TableView> ...
- EasyUi DataGrid 获取选中行的checkbox
EasyUi DataGrid 获取选中行的checkbox var checked = $(":checkbox[name=ID]:checked"); console.log( ...
- easy ui datagrid 获取选中行的数据
取得选中行数据: var row = $('#tt').datagrid('getSelected'); if (row){ alert('Item ID:'+row.itemid+" Pr ...
- [Irving] Wpf DevexPress GridControl 获取选中行
WPF前台绑定事件代码: <RelayAction TargetControl="{Binding ElementName=GCInstoragePart}" MethodN ...
- easyui datagrid 禁止选中行
没有找到可以直接禁止的属性,但是找到两个间接禁止的方式. 方式一: //onClickRow: function (rowIndex, rowData) { // $(this).datagr ...
- WPF DataGrid ListView 等等 改变 选中行 颜色;以及 不变的原因
WPF中改变选中行的颜色是很简单的,就是用触发器:比如:以DataGrid为例: DataGrid.RowStyle Style TargetType= DataGridRow SetterPrope ...
- datagrid如何获取选中行的索引
//datagrid获取选中行 var row =baseSelectgrid.datagrid('getSelected'); // 获取被选中行的索引 index var index=baseSe ...
随机推荐
- 虚拟机安装Centos6.5服务器系统
前言: 工作需要,研究Linux数日,写下此教程,意在给其他初学者参考学习,亦是给自己留作备用.好记性不如烂笔头,毕竟只是偶尔使用,留下教程,以备不时之需. 对于学习研究Linux的新手,个人推荐VM ...
- sqlserver 几种datatime的区别
参考文章1 smalldatetime 占4位精确到分钟.时间从1900.1.1到2079.6.6datetime占8位精确到毫秒.时间从1753.1.1到9999.12.31 参考文章2 datet ...
- SweetAlert2 弹窗
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...
- [leetcode]438. Find All Anagrams in a String找出所有变位词
Given a string s and a non-empty string p, find all the start indices of p's anagrams in s. Strings ...
- [leetcode]680. Valid Palindrome II有效回文II(可至多删一原字符)
Given a non-empty string s, you may delete at most one character. Judge whether you can make it a pa ...
- Redis安装异常解决办法
官网地址:http://redis.io/ 官网下载地址:http://redis.io/download 1. 下载Redis源码(tar.gz),并上传到Linux 2. 解压缩包:tar zxv ...
- POJ 1122.FDNY to the Rescue! Dijkstra
FDNY to the Rescue! Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 2808 Accepted: 86 ...
- jQuery load和unload函数使用
实例 当用户点击链接离开本页时,弹出一个消息框: $(window).unload(function(){ alert("Goodbye!"); }); 亲自试一试 定义和用法 当 ...
- 3层+SVN学习笔记(2)
在对于餐桌付款程序设计时,需要先选中餐桌,然后点击付款.正常情况是这样的: 在程序设计时,没有考虑到用户未点击餐桌而直接进行付款的情况,程序出现以下错误: 在设计时,需要考虑用户未点击餐桌而直接进行付 ...
- 2018.09.28 hdu5435A serious math problem(数位dp)
传送门 数位dp卡常题. 写了一发dfs版本的发现过不了233. 于是赶紧转循环版本. 预处理出f数组. f[i][j]f[i][j]f[i][j]表示前i位数异或和为j的方案数. 然后每次直接数位d ...