Skip to content

Styles

ListBoxListBoxItemItemsPanelTemplate
ListBoxBaseStyleListBoxItemBaseStyle.SmallWrapPanelHorizontalItemsPanelTemplate
ListBox.SmallListBoxItemCustomWrapPanelVerticalItemsPanelTemplate
ListBoxCustomStackPanelHorizontalItemsPanelTemplate
WrapPanelHorizontalListBoxStackPanelVerticalItemsPanelTemplate
WrapPanelVerticalListBox
StackPanelHorizontalListBox
StackPanelVerticalListBox

Styles (Custom Version)

NOTE

This style is Only Available in Custom Version

ListBoxListBoxItem
ListBoxModernStyleListBoxItemNewStyle
ListBoxTransparentStyleListBoxModernItemBaseStyle
ListBoxModernBaseStyleListBoxItemBaseTransparent
ListBoxBaseTransparentStyleListBoxItemBaseNewStyle

Attached Property

PropertiesDescription
IsOddEvenRowChange Listbox Item Background based on odd and even row Only Custom Version
IsNewAdd New Label next to the text Only Custom Version
GeometryChange IsNew Geometry Only Custom Version
GeoemtryBrushChange Geometry Brush Only Custom Version
WidthChange Geometry Width Only Custom Version
HeightChange Geometry Height Only Custom Version

ListBoxBaseStyle

  ListBox default style is not recommended to use directly, it should always be used by other styles in BasedOn mode.

Example:

xml
<ListBox hc:ListBoxAttach.IsOddEvenRow="True" AlternationCount="2"/>

ListBox.IsOddEvenRow

NOTE

Example:

<Style BasedOn = "{StaticResource ListBoxBaseStyle}" TargetType = "ListBox" />

ListBox.BaseStyle

ListBoxCustom : ListBoxBaseStyle

ListBox ListCustomstyle, which retains the basic attribute style of the Listbox, and the data display style is customized by the current user to achieve personalized customization.

NOTE

Example:

    <ListBox Margin="10" ItemsSource="{Binding Datas}"  
             Style="{DynamicResource ListBoxCustom}">
        <ListBox.ItemTemplate>
            <DataTemplate>
                <Border BorderThickness="1" BorderBrush="Black" Margin="0,5">
                    <DockPanel LastChildFill="True">
                        <Path DockPanel.Dock="Left" Fill="YellowGreen" Width="20" Margin="10,0,10,0" HorizontalAlignment="Center" Data="{DynamicResource BubbleTailGeometry}"></Path>
                        <TextBlock Padding="10" Text="{Binding Name}"></TextBlock>
                    </DockPanel>
                </Border>
            </DataTemplate>
        </ListBox.ItemTemplate>
    </ListBox>

ListBox.CustomStyle

WrapPanelHorizontalListBox : ListBoxCustom

The layout container is WrapPanel, and the display style is horizontal.

NOTE

Example:

    <ListBox Margin="10" ItemsSource="{Binding Datas}"  
             Style="{DynamicResource WrapPanelHorizontalListBox}">
        <ListBox.ItemTemplate>
            <DataTemplate>
                <Border BorderThickness="1" BorderBrush="Black" Margin="5,0">
                    <DockPanel LastChildFill="True">
                        <Path DockPanel.Dock="Left" Fill="YellowGreen" Width="20" Margin="10,0,10,0" HorizontalAlignment="Center" Data="{DynamicResource BubbleTailGeometry}"></Path>
                        <TextBlock Padding="10" Text="{Binding Name}"></TextBlock>
                    </DockPanel>
                </Border>
            </DataTemplate>
        </ListBox.ItemTemplate>
    </ListBox>

ListBox.WrapPanelHorizontalStyle

WrapPanelVerticalListBox : ListBoxCustom

The layout container is WrapPanel, and the display style is vertical.

NOTE

Example:

    <ListBox Margin="10" ItemsSource="{Binding Datas}"  
             Style="{DynamicResource WrapPanelVerticalListBox}">
        <ListBox.ItemTemplate>
            <DataTemplate>
                <Border BorderThickness="1" BorderBrush="Black" Margin="0,5">
                    <DockPanel LastChildFill="True">
                        <Path DockPanel.Dock="Left" Fill="YellowGreen" Width="20" Margin="10,0,10,0" HorizontalAlignment="Center" Data="{DynamicResource BubbleTailGeometry}"></Path>
                        <TextBlock Padding="10" Text="{Binding Name}"></TextBlock>
                    </DockPanel>
                </Border>
            </DataTemplate>
        </ListBox.ItemTemplate>
    </ListBox>

ListBox.WrapPanelVerticalStyle

StackPanelHorizontalListBox : ListBoxCustom

The layout container is a StackPanel, and the display style is horizontal.

NOTE

Example:

    <ListBox Margin="10" ItemsSource="{Binding Datas}"  
             Style="{DynamicResource StackPanelHorizontalListBox}">
        <ListBox.ItemTemplate>
            <DataTemplate>
                <Border BorderThickness="1" BorderBrush="Black" Margin="5,0">
                    <DockPanel LastChildFill="True">
                        <Path DockPanel.Dock="Left" Fill="YellowGreen" Width="20" Margin="10,0,10,0" HorizontalAlignment="Center" Data="{DynamicResource BubbleTailGeometry}"></Path>
                        <TextBlock Padding="10" Text="{Binding Name}"></TextBlock>
                    </DockPanel>
                </Border>
            </DataTemplate>
        </ListBox.ItemTemplate>
    </ListBox>

ListBox.StackPanelHorizontalStyle

StackPanelVerticalListBox : ListBoxCustom

The layout container is a StackPanel, which displays the style vertically.

NOTE

Example:

    <ListBox Margin="10" ItemsSource="{Binding Datas}"  
             Style="{DynamicResource StackPanelVerticalListBox}">
        <ListBox.ItemTemplate>
            <DataTemplate>
                <Border BorderThickness="1" BorderBrush="Black" Margin="0,1">
                    <DockPanel LastChildFill="True">
                        <Path DockPanel.Dock="Left" Fill="YellowGreen" Width="20" Margin="10,0,10,0" HorizontalAlignment="Center" Data="{DynamicResource BubbleTailGeometry}"></Path>
                        <TextBlock Padding="10" Text="{Binding Name}"></TextBlock>
                    </DockPanel>
                </Border>
            </DataTemplate>
        </ListBox.ItemTemplate>
    </ListBox>

ListBox.StackPanelVerticalStyle

ListBoxModernStyle

NOTE

This style is Only Available in Custom Version

you can use IconElement and ListBoxAttach AttachedProperty

<ListBox Style="{StaticResource ListBoxModernStyle}" Width="200" Margin="32">
    <ListBoxItem Content="Item 1" hc:IconElement.Height="16" hc:IconElement.Width="16" hc:IconElement.Geometry="{StaticResource ConfigGeometry}"/>
    <ListBoxItem Content="Item 2" hc:ListBoxAttach.IsNew="True" hc:IconElement.Height="16" hc:IconElement.Width="16" hc:IconElement.Geometry="{StaticResource ConfigGeometry}"/>
    <ListBoxItem Content="Item 3" hc:ListBoxAttach.IsNew="True" hc:ListBoxAttach.GeoemtryBrush="{DynamicResource WarningBrush}" hc:ListBoxAttach.Geometry="{DynamicResource ClockGeometry}" hc:IconElement.Height="16" hc:IconElement.Width="16" hc:IconElement.Geometry="{StaticResource ConfigGeometry}"/>
</ListBox>

ListBox.ListBoxModernStyle

ListBoxTransparentStyle

This style is Only Available in Custom Version

<ListBox Style={StaticResource ListBoxTransparentStyle}/>

ListBoxItemNewStyle

This style is Only Available in Custom Version

this style is for Listbox Item with a new geometry icon

xml
<ListBox>
<ListBoxItem Style="{StaticResource ListBoxItemNewStyle}"/>
</ListBox>

Released under the MIT License.