<DataGrid.Columns> <DataGridTextColumn Binding="{Binding Property1}" Header="Property1"/> <DataGridCheckBoxColumn Binding="{Binding Property2}" Header="Property2"/> <DataGridTemplateColumn Header="功能" CellTemplate="{DynamicResource DataTemplate1}"/> </DataGrid.Columns>
Header为功能的那一列是我要添加的按钮,用的CellTemplate模板,事实上,正如我标题中所写,CellTemplate不是依赖属性,不能绑定DynamicResource,最后的代码是这个样子的:
<DataGrid.Columns> <DataGridTextColumn Binding="{Binding Property1}" Header="Property1"/> <DataGridCheckBoxColumn Binding="{Binding Property2}" Header="Property2"/> <DataGridTemplateColumn Header="功能" CellTemplate="{StaticResource DataTemplate1}"/> </DataGrid.Columns>
原文地址:https://www.jb51.cc/javaschema/287077.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。