Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7538951
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:15:15+00:00 2026-05-30T07:15:15+00:00

I want to set a style for a list box item in which we

  • 0

I want to set a style for a list box item in which we can provide alternate row colors along with border color changed on mouse hover and IsSelected property. Please give me some example where I can refer from.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T07:15:17+00:00Added an answer on May 30, 2026 at 7:15 am

    This is an example taken from Codeplex project for WPF Themes (BureauBlue Theme)

    You can modify the theme as you want

    List Box Item Theme

    <Style   TargetType="{x:Type ListBoxItem}">
        <Setter Property="SnapsToDevicePixels" Value="true" />
        <Setter Property="OverridesDefaultStyle" Value="true" />
        <Setter Property="Padding" Value="3" />
        <Setter Property="Foreground" Value="{StaticResource OutsideFontColor}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListBoxItem}">
                    <ControlTemplate.Resources>
                        <Storyboard x:Key="HoverOn">
                            <DoubleAnimation Duration="00:00:00.1000000"
                                             Storyboard.TargetName="BackgroundGradientOver"
                                             Storyboard.TargetProperty="Opacity"
                                             To="0.73" />
                        </Storyboard>
                        <Storyboard x:Key="HoverOff">
                            <DoubleAnimation Duration="00:00:00.4000000"
                                             Storyboard.TargetName="BackgroundGradientOver"
                                             Storyboard.TargetProperty="Opacity"
                                             To="0" />
                        </Storyboard>
                        <Storyboard x:Key="SelectedOn">
                            <DoubleAnimation Duration="00:00:00.1000000"
                                             Storyboard.TargetName="BackgroundGradientSelected"
                                             Storyboard.TargetProperty="Opacity"
                                             To="0.84" />
                            <DoubleAnimation Duration="00:00:00.1000000"
                                             Storyboard.TargetName="BackgroundGradientSelectedDisabled"
                                             Storyboard.TargetProperty="Opacity"
                                             To="0.55" />
                        </Storyboard>
                        <Storyboard x:Key="SelectedOff">
                            <DoubleAnimation Duration="00:00:00.4000000"
                                             Storyboard.TargetName="BackgroundGradientSelected"
                                             Storyboard.TargetProperty="Opacity"
                                             To="0" />
                            <DoubleAnimation Duration="00:00:00.4000000"
                                             Storyboard.TargetName="BackgroundGradientSelectedDisabled"
                                             Storyboard.TargetProperty="Opacity"
                                             To="0" />
                        </Storyboard>
                    </ControlTemplate.Resources>
                    <Grid SnapsToDevicePixels="true">
                        <Rectangle x:Name="BackgroundGradientOver"
                                   Fill="{DynamicResource MouseOverBrush}"
                                   Opacity="0"
                                   RadiusX="1"
                                   RadiusY="1"
                                   Stroke="{DynamicResource MouseOverBorderBrush}" />
                        <Rectangle x:Name="BackgroundGradientSelectedDisabled"
                                   Fill="{DynamicResource ListItemSelectedBrush}"
                                   Opacity="0"
                                   RadiusX="1"
                                   RadiusY="1"
                                   Stroke="{DynamicResource ListItemSelectedBorderBrush}" />
                        <Rectangle x:Name="BackgroundGradientSelected"
                                   Fill="{DynamicResource PressedBrush}"
                                   Opacity="0"
                                   RadiusX="1"
                                   RadiusY="1"
                                   Stroke="{DynamicResource PressedBorderBrush}"
                                   StrokeThickness="1" />
                        <ContentPresenter x:Name="contentPresenter"
                                          Margin="{TemplateBinding Padding}"
                                          HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                          Content="{TemplateBinding Content}"
                                          ContentTemplate="{TemplateBinding ContentTemplate}" />
                    </Grid>
                    <ControlTemplate.Triggers>
    
                        <Trigger Property="IsSelected" Value="true">
                            <Trigger.ExitActions>
                                <BeginStoryboard x:Name="SelectedOff_BeginStoryboard"
                                                 Storyboard="{StaticResource SelectedOff}" />
                            </Trigger.ExitActions>
                            <Trigger.EnterActions>
                                <BeginStoryboard x:Name="SelectedOn_BeginStoryboard"
                                                 Storyboard="{StaticResource SelectedOn}" />
                            </Trigger.EnterActions>
    
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Trigger.ExitActions>
                                <BeginStoryboard x:Name="HoverOff_BeginStoryboard"
                                                 Storyboard="{StaticResource HoverOff}" />
                            </Trigger.ExitActions>
                            <Trigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource HoverOn}" />
                            </Trigger.EnterActions>
                        </Trigger>
    
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{DynamicResource DisabledForegroundBrush}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
            <Style.Triggers>
                <Trigger Property="ItemsControl.AlternationIndex" Value="0">
                    <Setter Property="Background" Value="#19f39611"></Setter>
                </Trigger>
                <Trigger Property="ItemsControl.AlternationIndex" Value="1">
                    <Setter Property="Background" Value="#19000000"></Setter>
                </Trigger>
            </Style.Triggers>        
    </Style>
    

    In List Box

    <ListBox AlternationCount="2">
    </ListBox>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I cannot set the background color for the selected item on a list box.
how can i set the header style of the p:panel component? i want to
I want to set the multi selection to my multi list box. I have
I want to set the background color separately for each item in a WPF
I want to set the font-style and font-size of the text in my HTML
Can somebody help me to set diferent styles to firstchild and lastchild? I want
Hi i have the following auto-suggestion box set up and i want to select
I have a webpage with 2 list box ( list1, list2 ), I can
All, I have list items which have a background set to them (RGBA value).
I want set interfaceOrientation in one UIView as LandscapeLeft and Portrait in other UIView.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.