How can I change font size of categories?

Grids for WPF Forum

Posted 11 years ago by Dariusz Wąsacz
Version: 12.2.0573
Avatar

I'd like to change the category appearance for all categories in PropertyGrid. I'd like to set font color to Gray, FontSize to 14 (bigger than properties) and FontWeight to Normal. I tried the following code:

 

            <Style TargetType="{x:Type propgrid:PropertyGridDataAccessorItem}">
                <Style.Triggers>
                    <Trigger Property="DataAccessorType"
                             Value="Category">
                        <Setter Property="Foreground"
                                Value="Gray" />
                        <Setter Property="FontSize"
                                Value="14" />
                        <Setter Property="FontWeight"
                                Value="Normal" />
                    </Trigger>
                </Style.Triggers>
            </Style>

 This code doesn't give the correct effect:

  1. The font color of categories is set correctly to Gray
  2. FontSize affects both categories and properties. I don't want properties to have bigger font size.
  3. FontWeight is not changed - it remains Bold.

What should I correct to have the desired effect?

Comments (2)

Answer - Posted 11 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Dariusz,

Instead of setting those three properties, try to set the HeaderTemplate property instead.  Our default value is:

<Setter Property="HeaderTemplate">
	<Setter.Value>
		<DataTemplate>
			<TextBlock Text="{Binding}" />
		</DataTemplate>
	</Setter.Value>
</Setter>

You can set the properties you want right on that TextBlock.


Actipro Software Support

Posted 11 years ago by Dariusz Wąsacz
Avatar

It works perfect. Thank you :-)

The latest build of this product (v24.1.2) was released 11 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.