Skip to main content

ListBoxEdit.ItemContainerStyle Property

Gets or sets the style applied to a list item container. This is a dependency property.

Namespace: DevExpress.Xpf.Editors

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

NuGet Package: DevExpress.Wpf.Core

Declaration

public Style ItemContainerStyle { get; set; }

Property Value

Type Description
Style

A Style object that contains style settings.

Remarks

ListBoxEdit - ItemContainerStyle Example

<dxe:ListBoxEdit ItemsSource="{Binding Customers}">
    <dxe:ListBoxEdit.ItemContainerStyle>
        <Style TargetType="dxe:ListBoxEditItem">
            <Setter Property="Background" Value="#FFF2F2F2"/>
            <Setter Property="Foreground" Value="Black"/>
            <Setter Property="Padding" Value="15,7"/>
            <Setter Property="FontSize" Value="14"/>
        </Style>
    </dxe:ListBoxEdit.ItemContainerStyle>
</dxe:ListBoxEdit>

The editor’s ItemContainerStyle property does not affect item appearance if you use the ListBoxEdit.StyleSettings property to define an operation mode. In this case, use the *StyleSettings object’s ItemContainerStyle property.

ListBoxStyleSettings - ItemContainerStyle Example

<Window ...
        xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
        xmlns:dxetk="http://schemas.devexpress.com/winfx/2008/xaml/editors/themekeys">
    <dxe:ListBoxEdit ItemsSource="{Binding Customers}" 
                     HorizontalContentAlignment="Stretch">
        <dxe:ListBoxEdit.StyleSettings>
            <dxe:RadioListBoxEditStyleSettings>
                <dxe:RadioListBoxEditStyleSettings.ItemContainerStyle>
                    <Style BasedOn="{StaticResource {dxetk:EditorListBoxThemeKey ResourceKey=RadioButtonItemStyle}}" 
                           TargetType="dxe:ListBoxEditItem">
                        <Setter Property="ContentTemplate">
                            <Setter.Value>
                                <DataTemplate>
                                    <Border BorderThickness="2" 
                                            Background="Orange" 
                                            BorderBrush="Blue" 
                                            CornerRadius="4">
                                        <TextBlock Text="{Binding}" Padding="2"/>
                                    </Border>
                                </DataTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </dxe:RadioListBoxEditStyleSettings.ItemContainerStyle>
            </dxe:RadioListBoxEditStyleSettings>
        </dxe:ListBoxEdit.StyleSettings>
    </dxe:ListBoxEdit>
See Also