WPF DataGrid RowHeader样式TargetType

问题描述 投票:0回答:1

我可以设计这个“红色”元素吗?

我可以在DataGridColumnHeader,DataGridRowHeader上设置样式,但我不知道如何在“red”元素上设置tyle。

wpf xaml wpfdatagrid
1个回答
2
投票

你的意思是DataGrid的左上角?这是一种按钮类型。您可以为其应用自定义样式。

<DataGrid.Resources>
    <Style TargetType="Button" x:Key="{ComponentResourceKey ResourceId=DataGridSelectAllButtonStyle, TypeInTargetAssembly={x:Type DataGrid}}">
        <Setter Property="Background" Value="Red" />
    </Style>
</DataGrid.Resources>

这是结果。

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.