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 3757160
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T09:57:48+00:00 2026-05-19T09:57:48+00:00

I have a Listbox with styles, including Listboxitem with styles. I am trying to

  • 0

I have a Listbox with styles, including Listboxitem with styles. I am trying to create an animation that changes opacity from 0 to 1, to make items show on the list. I’ve managed to do this with the following code:

<Style x:Key="ListBoxStyle1" TargetType="ListBox">
            <Setter Property="Foreground" Value="#FF393C3F" />
            <Setter Property="OverridesDefaultStyle" Value="true"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="ListBox">
                        <Border Name="Border" Background="{x:Null}" BorderBrush="Black" BorderThickness="0" Padding="0">
                            <ItemsPresenter />
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="ListBoxItemStyle1" TargetType="ListBoxItem">
            <Setter Property="Opacity" Value="0" />
            <Setter Property="Height" Value="16" />
            <Setter Property="VerticalContentAlignment" Value="Bottom" />
            <Setter Property="VerticalAlignment" Value="Bottom" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="ListBoxItem">
                        <Border Name="Border" Padding="10,1,0,0" Background="{x:Null}">
                            <ContentPresenter VerticalAlignment="Center" SnapsToDevicePixels="True" />
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsSelected" Value="true">
                                <Setter TargetName="Border" Property="Background" Value="{StaticResource arrow}" />
                            </Trigger>
                            <Trigger Property="IsMouseOver" Value="true">
                                <Setter Property="Foreground" Value="#FF828689" />
                            </Trigger>
                            <Trigger Property="IsVisible" Value="true">
                                <Trigger.EnterActions>
                                    <BeginStoryboard>
                                        <Storyboard>
                                            <DoubleAnimation Storyboard.TargetProperty="Opacity" From="0.0" To="1.0" Duration="0:0:0.4" />
                                        </Storyboard>
                                    </BeginStoryboard>
                                </Trigger.EnterActions>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

The thing works as it should (apart from that I want more time to pass between current and next item animation start. But it has a problem with opacity. Everything possible is set to transparent, backgrounds and all. And I use transparent .png brush for selected item.

The problem is with the opacity animation and is best seen on the bottom picture:

Screenshot

This is a screenshot in the middle of animation (at the time the opacity of the listboxitems is 0.8) and you can clearly see white background around all text. It’s even more visible in the first selected item, because it uses transparent .png. This background magically dissapears when animation is finished and the opacity is 1.0.

How to fix this problem? Did I forget to set any background perhaps?

Thank you for your help!

Edit:

I am adding my listbox declaration:

<ListBox Height="239" HorizontalAlignment="Left" Margin="0,0,0,0" Name="listBox1" VerticalAlignment="Top" Width="145" Background="{x:Null}"  FontWeight="Black" FontSize="8" BorderBrush="{x:Null}" SnapsToDevicePixels="True" BorderThickness="0" ItemContainerStyle="{StaticResource ListBoxItemStyle1}" Style="{StaticResource ListBoxStyle1}">
    <ListBox.ItemsPanel>
        <ItemsPanelTemplate>
            <VirtualizingStackPanel VerticalAlignment="Top" Background="{x:Null}" />
        </ItemsPanelTemplate>
    </ListBox.ItemsPanel>
</ListBox>

Also another question is: How to delay the animation that each listboxitem would be displayed with a delay of few milliseconds before the next one?

Thank you for all your help.

  • 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-19T09:57:49+00:00Added an answer on May 19, 2026 at 9:57 am

    I have fixed the problem. The problem was that in code I was overriding window’s AllowTransparency flag. Now it works as it should. If anyone would encounter a similar problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a StackPanel that I dynamically hide/show items from, and I would like
I have a ListBox with items that fill TextBox es. How do I identify
I have a listbox that users can add/remove from. To add, there's a text
I have a ListBox that each of its items has a button, I set
I have a ListBox that during development I had the items in the ListBox
I have a CheckedListBox (WinForms) control (which inherits from ListBox; googling shows that the
I have a ListBox that can contain hundreds of items. I've added the following
I have a ListBox in a file called Downloads.XAML. The items bound to that
I have a ListBox and I need to repeat the styles to be the
I have created styled a ListBox in WPF so that it is rendered as

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.