WPF:如何在一个样式类中设置 DataGridTextColumn 的样式?
我尝试分别对 DataGridTextColumn 设置标题和单元格样式进行样式化:
<Style x:Key="headerStyle">
<Setter Property="DataGridColumnHeader.Background" ... />
...
<Style x:Key="cellStyle">
<Setter Property="DataGridCell.Background" ... />
...
<DataGrid>
<DataGrid.Columns>
<DataGridTextColumn
HeaderStyle="{StaticResource ResourceKey='headerStyle'}"
CellStyle="{StaticResource ResourceKey='cellStyle'}" ... />
Can I stylize DataGridTextColumn 标题、单元格和其他属性在一个样式声明中吗?
I try to stylize DataGridTextColumn setting Header and Cell styles separatly:
<Style x:Key="headerStyle">
<Setter Property="DataGridColumnHeader.Background" ... />
...
<Style x:Key="cellStyle">
<Setter Property="DataGridCell.Background" ... />
...
<DataGrid>
<DataGrid.Columns>
<DataGridTextColumn
HeaderStyle="{StaticResource ResourceKey='headerStyle'}"
CellStyle="{StaticResource ResourceKey='cellStyle'}" ... />
Can I stylize DataGridTextColumn Header, Cell and other properties in one style declaration?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
据我所知,这可能是不可能的,因为
DataGridTextColumn
不提供自己的 Template 或 Style 属性,可用于集体设置其他样式。As far as i can tell that might be impossible since
DataGridTextColumn
does not provide a Template or Style property of its own which could be used to set the other styles collectively.