Foreground color for ReadOnly PropertyItem on selection

Grids for WPF Forum

Posted 15 years ago by Anurodh Ora
Version: 4.5.0486
Avatar
Hi,

On selection of ReadOnly property items the foreground color is similar to the normal propertyitems (i.e. Non ReadOnly) for all the build-in and system themes.

User may get confuse about ReadOnly/Non ReadOnly that what he has selected.

It should be different.

Is it a bug or any other way to set different foreground color for selection of readonly property items.


Thanks

Anurodh

Comments (1)

Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Anurodh,

This is working as designed, which follows how the WinForms PropertyGrid works. The only theme that could probably get away with keeping the gray text is the Aero theme. The others might have a conflict with the highlight background.

You can customize the name cells in the same way that the value cells can be customized, using property editors. In this case you'd want to use a DataTemplate which contains a TextBlock that bypass the Foreground changes. Something like this will work:
<propgrid:PropertyGrid ...>
    <propgrid:PropertyGrid.PropertyEditors>
        <propgrid:PropertyEditor>
            <propgrid:PropertyEditor.NameTemplate>
                <DataTemplate>
                    <TextBlock Margin="4,0,0,0" HorizontalAlignment="Stretch" VerticalAlignment="Center"
                            Foreground="{Binding Foreground, RelativeSource={RelativeSource AncestorType={x:Type propgrid:PropertyGridDataAccessorItem}}}"
                            Text="{Binding DisplayName, RelativeSource={RelativeSource AncestorType={x:Type propgrid:IPropertyDataAccessor}}}" />
                </DataTemplate>
            </propgrid:PropertyEditor.NameTemplate>
        </propgrid:PropertyEditor>
    </propgrid:PropertyGrid.PropertyEditors>
</propgrid:PropertyGrid>


Actipro Software Support

The latest build of this product (v24.1.1) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.