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 ...
随机推荐
- 3.滑雪-深搜&dp
//Michael喜欢滑雪百这并不奇怪, 因为滑雪的确很刺激.可是为了获得速度,滑的区域必须向下倾斜,而且当你滑到坡底,你不得不再次走上坡或者等待升降机来载你.Michael想知道载一个区域中最长底滑 ...
- 通过dockerfile构建nginx
上次 利用命令行的形式来构建nginx服务, http://www.cnblogs.com/loveyouyou616/p/6806788.html 这次利用dockerfile文件来构建nginx服 ...
- win下php的memcached的安装与使用
1.memcache的php扩展与memcached服务器的区别? php要操作memcached就必须要安装memcache的扩展, 在http://windows.php.net/download ...
- MongoDB 3.0 Release Notes
MongoDB 3.0支持WiredTiger存储引擎,提供可插拔存储引擎API,新增SCRAM-SHA-1认证机制,改进explain功能. 可插拔存储引擎API 允许第三方为MongoDB开发存储 ...
- Codeforces 670D1. Magic Powder - 1 暴力
D1. Magic Powder - 1 time limit per test: 1 second memory limit per test: 256 megabytes input: stand ...
- Jmeter获取不到cookie(备注:前面和后面的几个步骤都可以获取到cookie)
今天的一个Jmeter脚本,有一个HTTP request始终获取不到cookie,但其前面和后面的几个步骤都可以获取到cookie,报文的请求服务器地址都是照着fiddler上面填的,没有问题,后来 ...
- 模型参数_grid
from sklearn import datasetsfrom sklearn.model_selection import train_test_splitfrom sklearn.preproc ...
- 设计社区类Web原型制作分享-Behance
Behance 是著名设计社区,创意设计人士可以展示自己的作品,发现别人分享的创意作品. 网站有二级导航,主要用到的交互组件有弹出面板,通过弹出面板来隐藏展现搜索框.并且用到的组件有播放器.菜单栏.下 ...
- c++11日志练习
/************************************************************** 技术博客 http://www.cnblogs.com/itdef/ ...
- github 如何添加项目代码
1.点添加一个resporitory 2.添加的时候一定要选上下面的添加readme这个选项 3.点进去点code就能create file了.贴上代码就行.主要是第二步必须选对