开发者

WPF: how can I style DataGridTextColumn in one style class?

开发者 https://www.devze.com 2023-02-20 14:25 出处:网络
I开发者_如何学运维 try to stylize DataGridTextColumn setting Header and Cell styles separatly:

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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消