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

  • Home
  • SEARCH
  • 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 6770487
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:19:05+00:00 2026-05-26T15:19:05+00:00

I have a ListBox which is databound to an ObservableCollection and has a complex

  • 0

I have a ListBox which is databound to an ObservableCollection and has a complex ItemContainerStyle (with images, progress bars and text)

When I try to apply a filter on its CollectionView, with about 200 items in the collection, the UI will freeze for 2-3 seconds. This only occurs when the ListBox’s height is not fixed (ie is allowed to grow). It is instant when the ListBox height is set to a value, eg 500

<Style x:Key="CollectionStyle" TargetType="{x:Type ListBoxItem}">
        <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate>
                <Border x:Name="Bd" VerticalAlignment="Center" BorderBrush="Transparent" BorderThickness="1" CornerRadius="3.5" Margin="2" Padding="2">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="50"/>
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <Image Grid.Column="0" Source="{Binding Path=ListIcon}" Width="32" Margin="5,5,0,5" VerticalAlignment="Center" />
                        <Grid Grid.Column="1">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>

                            <StackPanel Orientation="Horizontal" Margin="10,0">
                                <TextBlock Text="{Binding Path=Name}" HorizontalAlignment="Stretch" VerticalAlignment="Center" Style="{StaticResource TextFontStyleTextBlock}" FontSize="14" TextTrimming="CharacterEllipsis" />
                                <TextBlock HorizontalAlignment="Stretch" VerticalAlignment="Center" Text="{Binding Path=Time,UpdateSourceTrigger=PropertyChanged,Mode=OneWay}" Style="{StaticResource LabelFontStyleTextBlock}"  TextTrimming="CharacterEllipsis" FontSize="12" Margin="5,0,0,0"/>
                            </StackPanel>

                            <ProgressBar Grid.Row="1" Height="10" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Margin="10,0,10,0" Value="{Binding Percentage, Mode=OneWay, Converter={StaticResource doubleToProgress}}">
                                <ProgressBar.Foreground>
                                    <MultiBinding Converter="{StaticResource ProgressBarColorConverter}">
                                        <Binding Mode="OneWay" Path="Percentage" />
                                        <Binding Mode="OneWay" Path="IsStatic" />
                                    </MultiBinding>
                                </ProgressBar.Foreground>
                            </ProgressBar>

                            <StackPanel Orientation="Horizontal" Grid.Row="2" Margin="10,0,10,0">
                                <Image VerticalAlignment="Center" Visibility="{Binding IsStatic, Converter={StaticResource CollapsedIfFalse}, Mode=OneWay, FallbackValue=Collapsed}" Source="/Common;component/Images/alert.ico" Margin="2,2,2,2"
                                                    RenderOptions.BitmapScalingMode="HighQuality"
                                                   RenderOptions.EdgeMode="Aliased" />
                                <TextBlock HorizontalAlignment="Stretch" VerticalAlignment="Center" Text="{Binding Path=Description,Mode=OneWay}" Foreground="Gray" TextTrimming="CharacterEllipsis" FontSize="11"/>
                            </StackPanel>
                        </Grid>
                    </Grid>
                </Border>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
<ListBox Grid.Row="0" x:Name="items" ItemsSource="{Binding Path=MyCollection}"
                                 ItemContainerStyle="{StaticResource CollectionStyle}"   />

Is there a way to fix this freezing? Having a fixed height on the ListBox is not an acceptable outcome, as it causes a vertical scroll bar to appear in a control which already has a vertical scroll bar

  • 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-26T15:19:05+00:00Added an answer on May 26, 2026 at 3:19 pm

    Having a fixed height on the ListBox is not an acceptable outcome, as it causes a vertical scroll bar to appear in a control which already has a vertical scroll bar

    This looks suspicious to me. When the immediate parent panel of the ListBox is not Grid or DockPanel (where its last child is a ListBox with LastChildFill=true), the listbox looses its virtualization and scrolling. As virtualization is lost, the listbox de-virtualizes all rows and while doing so hangs the UI thread.

    Is your ListBox wrapped in some kind of a scroll viewer? Sadly if thats the case, you will either have to skip the scroll viewer or apply fixed size to the ListBox.

    If you want the list box to auto-occupy remaining space of the container, do some binding to the parent panel’s actual height ptoperty via some converter and “calculate” required Height for the ListBox in that converter. This way it will look like the ListBox occupies all the space but is actually been applied with some fixed height via binding.

    But this can be tricky based on situation!

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

Sidebar

Related Questions

I have a databound listbox which is actually displaying two columns of data. It
I have a ListBox which uses a DataTemplate to render databound items. The XAML
I have WPF ListBox which is bound to a ObservableCollection, when the collection changes,
I have this ListBox which is bound to an ObservableCollection. Each object in the
[Original] I have a ListBox which has its ItemsSource (this is done in the
I have a listbox which has all the names for a list of Gesture
I have a listbox which has couple of items. When double clicked on each
I have a listbox which is databound to a collection of objects. I want
I have a listbox which has templates defined for the ItemContainer and the ItemTemplate
I have a ListBox which has StackPanel s holding a TextBlock and an Image

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.