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 ...
随机推荐
- Android学习笔记:Home Screen Widgets(2):关于Widget
通过widget定义,我们在widget列表中看到了我们的TestWidget.当我们拖拽widget到主页时,假设在appwidet-provider中定义了android:configure的ja ...
- iOS开发Quartz2D十二:手势解锁实例
一:效果如图: 二:代码: #import "ClockView.h" @interface ClockView() /** 存放的都是当前选中的按钮 */ @property ( ...
- synology
入手群晖261J无法正常安装DSM 错误代码38 求教各位恶魔https://www.chiphell.com/thread-1599081-1-1.html(出处: Chiphell - 分享与交流 ...
- 【codeforces 758B】Blown Garland
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...
- linux mysql 卸载,安装,測试全过程
Mysql卸载 yum remove mysql mysql-server mysql-libs compat-mysql51 rm -rf /var/lib/mysql rm /etc/my.cnf ...
- MAC终端:如何调整字体大小和终端样式
1.字体 进入终端后comman键和+键的组合可以增大显示 2.样式
- 在erlang项目中使用protobuf
在erlang项目中使用protobuf http://blog.csdn.net/mycwq/article/details/21864191 protobuf是google的一个序列化框架,类似X ...
- 利用marquee对html页面文本滚动
<marquee direction="up" style="width:200px;height:80px; " scrolldelay="3 ...
- 微信Android终端SDK新手使用指南
1.申请你的AppID 请到 开发者应用登记页面 进行登记,登记并选择移动应用进行设置后,将获得AppID,可立即用于开发.但应用登记完成后还需要提交审核,只有审核通过的应用才能正式发布使用. 2.下 ...
- 线性方程组的求解(C++)
1. 最佳求解方案 Most efficient way to solve a system of linear equations 求解形如 Ax=b 的最佳方式 将 A 分解为三角矩阵,A=M1⋅ ...