我正在使用 ComponentOne C1DataGrid。除了行标题列之外,我已经能够完全设置它的样式。
如何在 XAML 中设置样式?
您可以看到图像: 这里 谢谢,flot
回答我自己的问题以防其他人感兴趣:
有一个特殊的演示者,DataGridRowHeaderPresenter,可以设置样式。我想用树状“+”和“-”符号替换标准行详细信息切换,我这样做如下:
<Style x:Key="DataGridRowHeaderStyle2" TargetType="{x:Type c1:DataGridRowHeaderPresenter}">
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="FontSize" Value="12" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type c1:DataGridRowHeaderPresenter}">
<!-- BulletDecorator is used to provide baseline alignment between the sign and the Content -->
<BulletDecorator Background="#BFEFF2F5">
<BulletDecorator.Bullet>
<Grid Width="13" Height="13">
<Image Name="sign" Source="/myControls;component/Resources/Images/plus.png" />
</Grid>
</BulletDecorator.Bullet>
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" RecognizesAccessKey="True"/>
</BulletDecorator>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="true">
<Setter Property="Source" Value="/myControls;component/Resources/Images/minus.png" TargetName="sign"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>