DataGridTemplateColumn
DataGridTemplateColumn自定义单元格样式
<DataGrid Grid.Row="0" Name="BasicRuleDataGrid" PreviewMouseWheel="BasicRuleDataGrid_OnPreviewMouseWheel"
VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Auto"
AutoGenerateColumns="False"
RowDetailsVisibilityMode="VisibleWhenSelected"
SnapsToDevicePixels="True"
EnableRowVirtualization="False"
AreRowDetailsFrozen="False"
SelectionMode="Single"
ScrollViewer.IsDeferredScrollingEnabled="True"
IsReadOnly="True"
ItemsSource="{Binding ElementName=ComRuleMDataGrid, Path=SelectedItem.BasicRulesBinding}"
>
<!--上方:需要告知在ComRuleMDataGrid(子)里面找,在VM(父)里面找找不到-->
<DataGrid.AlternatingRowBackground>
<SolidColorBrush Color="#EBF7FC"></SolidColorBrush>
</DataGrid.AlternatingRowBackground>
<!--列-->
<DataGrid.Columns>
<DataGridTextColumn Width="*" Header="基本规则名称" Binding="{Binding BasRuleNameBinding}" />
<DataGridTextColumn Width="*" Header="基本规则说明" Binding="{Binding CommentBinding}" />
<DataGridTemplateColumn Header="是否删除" Width="Auto">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button HorizontalAlignment="Center" Tag="{Binding}" Style="{StaticResource BtADDStyle}" Content="-" Click="ButtonListDelet_OnClick_BasicRule"></Button>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
列表说明:
数据源ItemsSource绑定类的collection
选择项SelectedItem绑定类的一个对象(便于后台操作,自动)
显示绑定类中某一属性
DataGridTemplateColumn的更多相关文章
- 在WPF中获取DataGridTemplateColumn模板定义的内容控件
xaml格式描述: <DataGrid Name="dataGrid" Grid.Row="1" ItemsSource="{Binding}& ...
- wpf mvvm datagrid DataGridTemplateColumn的绑定无效的可能原因之一!
昨天在mvvm wpf的开发中遇到一个问题,绑定不起作用,编辑阶段没问题也没有提示找不到对应的绑定,但是在运行之后却不起作用,查了很多资料,说法不一,有些是要删除datagrid的一行,直接绑定del ...
- 在WPF中获取DATAGRIDTEMPLATECOLUMN模板定义的内容控件(转载)
原文:http://www.cnblogs.com/eric_ibm/p/3772516.html xaml格式描述: <DataGrid Name="dataGrid" G ...
- WPF学习笔记(4):获取DataGridTemplateColumn模板定义的内容控件
在之前的DataGrid的DataGridTemplateColumn列中,自定义了一个TextBox控件,但是在C#代码中提示找不到这个控件,导致无法对该控件进行操作.在网上搜索后,发现一些处理方法 ...
- WPF DataGrid DataGridTemplateColumn 控制模板中控件
<DataGrid Name="DG"> <DataGrid.Columns> < ...
- WPF中的DataGridTemplateColumn实现点击列标题排序
在DataGrid中使用模板列时,默认功能中对点击列标题是不对列值进行排序的,要排序就需要添加以下两个属性: 1.CanUserSort="True" 2.SortMemberPa ...
- DataGridTemplateColumn 如何获取内部控件
WPF中有时候我们不使用DataGridTextColumn 而使用用途更加宽广的DataGridTemplateColumn 但是用途多的东西当然也更复杂. 这里说下如何取DataGridTempa ...
- wpf datagridtemplatecolumn visibility binding
因为datagridtemplatecolumn不在Virsual Tree中,不能继承DataGrid的DataContext, 所以想要绑定到datagridtemplatecolumn的 vis ...
- DataGrid DataGridTemplateColumn
设置单元格的样式 <DataGrid.Columns> <DataGridTextColumn Header="检测项目" Binding="{Bind ...
随机推荐
- Warning: preg_replace(): Compilation failed: missing terminating ] for character class at offset 10 in
Warning: preg_replace(): Compilation failed: missing terminating ] for character class at offset 10 ...
- 【t084】数列
Time Limit: 1 second Memory Limit: 128 MB [问题描述] 一个数列定义如下:f(1) = 1,f(2) = 1,f(n) = (A * f(n - 1) + B ...
- AE属性表操作
转自chanyinhelv原文AE属性表操作 实现的操作包括:1.打开属性表:2.编辑属性表:3.增加属性列:4.数据排序:5.字段计算…… 嗯,实现的功能目前就这些吧,后续还会继续跟进,还望大家多多 ...
- Qt 通过绘画设置边框阴影
首先widget设置 setWindowFlags(Qt::FramelessWindowHint); setAttribute(Qt::WA_TranslucentBackground, true) ...
- js时间和时间戳之间如何转换(汇总)
js时间和时间戳之间如何转换(汇总) 一.总结 一句话总结: 1.js中通过new Date()来获取时间对象, 2.这个时间对象可以通过getTime()方法获取时间戳, 3.也可以通过getYea ...
- Angular.js回想+学习笔记(1)【ng-app和ng-model】
Angular.js中index.html简单结构: <!doctype html> <html ng-app> <head> <script src=&qu ...
- 【poj2406】next数组求循环节
传送门 题目分析 本题主要考察kmp中next数组在求循环时的运用: 字符串是循环的: len % (len - next[len]) == 0 字符串循环次数: len / (len - next[ ...
- 【77.39%】【codeforces 734A】Anton and Danik
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...
- Qt 元对象系统(Meta-Object System)(不管是否使用信号槽,都推荐使用)
Qt 元对象系统(Meta-Object System) Qt的元对象系统基于如下三件事情: 类:QObject,为所有需要利用原对象系统的对象提供了一个基类. 宏:Q_OBJECT,通常可以声明在类 ...
- 寄存器,cache、伙伴系统、内存碎片、段式页式存储管理
cache.伙伴系统.内存碎片.段式页式存储管理 目录 分层的存储管理 cache 局部性原理 置换算法 写回策略 linux环境下的cache 连续内存分配与内存碎片 内部碎片与外部碎片 动态分区分 ...