Skip to main content
All docs
V24.1

PropertyGridControl.RowStyleSelector Property

Gets or sets an object that chooses a RowStyle based on custom logic. This is a dependency property.

Namespace: DevExpress.Xpf.PropertyGrid

Assembly: DevExpress.Xpf.PropertyGrid.v24.1.dll

NuGet Package: DevExpress.Wpf.PropertyGrid

Declaration

public StyleSelector RowStyleSelector { get; set; }

Property Value

Type Description
StyleSelector

A StyleSelector descendant that chooses a style based on custom logic.

Remarks

The RowStyleSelector property allows you to apply a RowStyle based on a condition.

The following code sample applies a style to a row with today’s date:

WPF Property Grid - RowStyleSelector

public class RowStyleSelector : StyleSelector {
    public Style BDRowStyle { get; set; }
    public override Style SelectStyle(object item, DependencyObject container) {
        RowData rowData = item as RowData;
        if (rowData != null && rowData.Header == nameof(Customer.BirthDate)) {
            DateTime date = (DateTime)rowData.Value;
            DateTime today = DateTime.Today;
            if (date.Day == today.Day && date.Month == today.Month) {
                return BDRowStyle;
            }
        }
        return base.SelectStyle(item, container);
    }
}
<Window.Resources>
    <Style x:Key="bdRowStyle" TargetType="dxprg:RowControl">
        <Setter Property="Background" Value="Orange"/>
        <Setter Property="Foreground" Value="White"/>
    </Style>

    <local:RowStyleSelector x:Key="rowStyleSelector"
                            BDRowStyle="{StaticResource bdRowStyle}"/>
</Window.Resources>
<dxprg:PropertyGridControl ...
                           RowStyleSelector="{StaticResource rowStyleSelector}"/>

Refer to the following help topic for more information on appearance properties: Appearance Customization.

See Also