如何在数据网格中设置全选按钮的样式? [英] How to style the select all button in datagrid?
问题描述
我有一个 xaml 数据网格定义,我已经设置了所有样式,但我不知道如何设置数据网格角落左上角的按钮的样式,当您按下它时,该按钮用作全选".
I have a xaml datagrid definition, I have all my styles set up and all, but I don't know how to style that top left button in the corner of the datagrid which works as "select all" when you press it.
例如,我可以像这样设置数据网格单元格的样式:
For example, I can style datagrid cells like this:
<Style TargetType="DataGridCell">...
那么如何设置全选按钮的样式?有类似的吗?
So how do I style that select all button? Is there something like?
<Style TargetType="DataGridSelectAllButton">
?
推荐答案
好吧,如果我们去看看 文档 并在那里快速搜索DataGrid 左上角的按钮
",我们将找到 ResourceId=DataGridSelectAllButtonStyle
大约在该页面的一半,在他们的模板示例的顶部.
Right, so if we go look at the docs and do a quick page search there for "the button in the upper left corner of the DataGrid
" we'll find ResourceId=DataGridSelectAllButtonStyle
about halfway through that page, and at the top of their template examples.
我建议使用 Blend 来拆除像这样的控件部分,有时元素可能会被掩埋,而且只需右键单击并继续编辑模板直到找到您想要的内容,这非常方便需要而不是盲目地去做,这有时会是一种真正的痛苦.另外,首先检查文档应该是直观的第一个想法.
I would suggest using Blend to tear down the parts of controls like this, sometimes elements can be pretty buried and it's pretty darn handy to be able to just right-click and keep editing your way through the templates until you find what you need instead of trying to do it blind which sometimes can be a real pain. Plus, checking the docs first should be the intuitive first thought.
无论如何希望这会有所帮助,加油.
Anyway hope this helps, cheers.
这篇关于如何在数据网格中设置全选按钮的样式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!