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 ...
随机推荐
- Django---MVC设计模式
把数据存储逻辑.业务逻辑和表现逻辑组合在一起的概念被称为软件架构的 Model-View-Controller (MVC)模式. 在这个模式中, Model 代表数据存层,View 代表的是系统中选择 ...
- CRT(C Runtime Library)—— C/C++运行时库
C runtime library(part of the C standard library) 任何一个 C 程序,它的背后都有一套庞大的代码来进行支撑,使得该程序得以运行在更高级别上,而不必担心 ...
- 本人录制的视频资源(C/C++、Go、Qt、Linux等)
持续更新-- 编程语言 C语言开发实战:http://pan.baidu.com/s/1qXAP4x2 C语言贪吃蛇:https://pan.baidu.com/s/1pLRZIuJ C提高:http ...
- Android 面试之横竖屏切换的Activity生命周期
public class EngineerJspActivity extends Activity { private static String Tag = "EngineerJspAct ...
- 进入Erlang的世界
http://erlang.group.iteye.com/group/wiki/1407-to-enter-the-world-of-erlang 进入Erlang的世界 作为程序员,我们曾经闻听很 ...
- Watchdog问题实例分析
1.日志获取 Watchdog相关的问题甚至需要以下所有的日志: logcat 通过adb logcat命令输出Android的一些当前运行日志,可以通过logcat的 -b 参数指定要输出的日志缓冲 ...
- HDU 1081 To The Max - 最大字段和
传送门 题目大意: 求一个矩阵的最大子矩阵和. 题目分析: 刚开始考虑了一下dp方程的递推,但是不好转.简便的方法是预处理sum[i][j]表示第i行的前j个元素之和,之后\(n^3\)枚举子矩阵就可 ...
- java中的方法返回值使用泛型,实现灵活的返回值类型
痛点: 使用Mybatis框架的时候,想封装一个底层JDBC控制器,用于提供和Mybatis交互的增删改查接口(公用的接口),但由于公用的查询方法可能是用户自定义的任意一个和表对应的java ...
- JavaScript实现简单图片滚动 --9张图告诉你,C罗欲哭无泪
源代码下载:http://download.csdn.net/detail/u011043843/7510425 昨晚德国和葡萄牙的焦点之战你看了吗?北京时间凌晨的比赛中.C罗领衔的葡萄牙0-4德国被 ...
- Maven项目中读取src/main/resources目录下的配置文件
在Maven项目的开发中,当需要读取src/下的配置文件时,该怎么做? 我们假设Resources下有一个文件名为kafka.properties的配置文件(为什么用kafka.properties, ...