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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T22:15:28+00:00 2026-05-20T22:15:28+00:00

I am absolutely new to WPF. I can’t figure out why isn’t the VirtualizingStackPanel

  • 0

I am absolutely new to WPF. I can’t figure out why isn’t the VirtualizingStackPanel working for the following. I already have experimented with the ScrollViewer but it doesnt’ work for me. I have tried placing VirtualizingStackPanel every where but it seems to have no affect at all. The combobox when populated with 3000 item and each item has 16×16 image, takes around 30 seconds to show up. So any help will be appreciated.

Update: The datatemplate has been added

<DataTemplate x:Key="ComboBoxItemTemplate">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="20"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" SharedSizeGroup="col1"/>
                <ColumnDefinition Width="Auto" SharedSizeGroup="col2"/>
                <ColumnDefinition Width="Auto" SharedSizeGroup="col3"/>
                <ColumnDefinition Width="Auto" SharedSizeGroup="col4"/>
                <ColumnDefinition Width="Auto" SharedSizeGroup="col5"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Image
            Width="16"
            Height="16"
            Margin="1"
            Source="{Binding Image}"/>
            <StackPanel Grid.Column="1" Margin="1">
                <TextBlock Text="{Binding DisplayName}"/>
            </StackPanel>
            <StackPanel Grid.Column="2" Margin="5,1,1,1">
                <TextBlock Text="{Binding Column2}"/>
            </StackPanel>
            <StackPanel Grid.Column="3" Margin="5,1,1,1">
                <TextBlock Text="{Binding Column3}"/>
            </StackPanel>
            <StackPanel Grid.Column="4" Margin="5,1,1,1">
                <TextBlock Text="{Binding Column4}"/>
            </StackPanel>
            <StackPanel Grid.Column="5" Margin="5,1,1,1">
                <TextBlock Text="{Binding Column5}"/>
            </StackPanel>
            <StackPanel Grid.Column="6" Margin="5,1,1,1">
                <TextBlock Text="{Binding InheritanceDescription}"/>
            </StackPanel>
        </Grid>
    </DataTemplate>

    <Style TargetType="{x:Type local:ComboBox}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:ComboBox}">
                    <Grid x:Name="LayoutRoot" Width="Auto" Height="Auto">
                        <Grid.Resources>
                            <Style x:Key="AlternatingRows" TargetType="{x:Type ComboBoxItem}">
                                <Setter Property="Width" Value="{Binding Path=Dropdownwidth, RelativeSource={RelativeSource AncestorType={x:Type local:ComboBox}}}" />
                                <Setter Property="Background" Value="#FFE7ECF5"/>
                                <Setter Property="UIElement.IsEnabled" Value="{Binding IsEnabled}"/>
                            </Style>
                        </Grid.Resources>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <Label
                            Grid.Column="0"
                            HorizontalAlignment="Left" HorizontalContentAlignment="Left"
                            Margin="4,2,4,2"
                            Visibility="{Binding Path=NameVisibility, RelativeSource={RelativeSource TemplatedParent}}"
                            Target="{Binding ElementName=combobox1}">
                            <AccessText Text="{Binding Path=DisplayName, Converter={StaticResource appendColon}, RelativeSource={RelativeSource TemplatedParent}}"/>
                        </Label>
                        <ComboBox
                         x:Name="combobox1"
                         IsEditable="False"
                         AlternationCount="2"
                         Width="{Binding Path=ChildWidth, RelativeSource={RelativeSource TemplatedParent}}"
                         Grid.Column="1"
                         Grid.IsSharedSizeScope="True"
                         HorizontalAlignment="Left"
                         ItemContainerStyle="{StaticResource AlternatingRows}"
                         Margin="0,2,4,2"
                         ItemTemplate="{StaticResource ComboBoxItemTemplate}"
                         SelectedItem="{Binding Path=SelectedItem, RelativeSource={RelativeSource TemplatedParent}}"
                         ToolTip="{Binding Path=Description, RelativeSource={RelativeSource TemplatedParent}}"
                         BorderBrush="#95B7F3">
                            <ComboBox.ItemsPanel>
                                <ItemsPanelTemplate>
                                    <VirtualizingStackPanel VirtualizingStackPanel.IsVirtualizing="True"  VirtualizingStackPanel.VirtualizationMode="Recycling"/>
                                </ItemsPanelTemplate>
                            </ComboBox.ItemsPanel>
                        </ComboBox>
                        <StackPanel Grid.Column="2" Orientation="Horizontal" Width="Auto" Height="Auto">
                        <Label HorizontalAlignment="Left" HorizontalContentAlignment="Left" Margin="4,2,4,2" Height="Auto" Width="Auto"
                                Visibility="{Binding Path=UnitVisibility, RelativeSource={RelativeSource TemplatedParent}}"
                               >
                            <TextBlock Text="{Binding Path=DisplayUnit, RelativeSource={RelativeSource TemplatedParent}}"/>
                        </Label>
                        <Label Target="{Binding ElementName=combobox1}" HorizontalAlignment="Left" HorizontalContentAlignment="Left" Margin="4,2,4,2" Height="Auto" Width="Auto" MaxWidth="450"
                                Visibility="{Binding Path=DescriptionVisibility, RelativeSource={RelativeSource TemplatedParent}}"
                               >
                            <AccessText Text="{Binding Path=Description, RelativeSource={RelativeSource TemplatedParent}}" ToolTip="{Binding Path=Description, RelativeSource={RelativeSource TemplatedParent}}" TextTrimming="WordEllipsis" TextWrapping="Wrap"/>
                        </Label>
                        </StackPanel>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
  • 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-20T22:15:29+00:00Added an answer on May 20, 2026 at 10:15 pm

    The property for your image – have you made it so it creates the image when you access the property and not in the constructor? It sounds like it is loaded in the constructor 🙂

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

Sidebar

Related Questions

I am new to WPF, so the answer to the following question might be
I am absolutely new to the Android platform and have been building an application
I can't seem to figure this one out, no matter how much similar solutions
I have an absolutely positioned div containing several children, one of which is a
Considering this code, can I be absolutely sure that the finally block always executes,
I'm trying to create a WPF application where I can drag an image around.
I'm new in web services. I have faced some problem. At the server side
I have the following in a stored procedure: DECLARE @new_column_name varchar(9) DECLARE @table_name varchar(16)
I was thinking of making a new, light-weight database population framework. I absolutely hate
I'm new to web development and have started using JSONP and Google's Feed API

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.