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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T06:21:36+00:00 2026-06-09T06:21:36+00:00

I don’t like pasting rather long code snippets in here, but I have a

  • 0

I don’t like pasting rather long code snippets in here, but I have a problem with the following WPF UserControl (XAML at the end of this post). The provided code is simplified, but I tested it and it is reproducable.

The problem with this UserControl is, when added to a WPF Window, horizontal resizing is extremely slow. More precisely, when the window’s width is increased, resizing works as fast as expected. However, as soon as it’s width is decreased, the containing UserControl hangs and resizes only very slowly. On my PC it takes about 3 seconds to reach its final size.

My question now:
Why is this and what can I do about it? With this simplified control it may not be a huge problem, but if both ListViews are filled, operation is even slower.
Is this an issue with WPF itself or is there an error in the XAML? I don’t know. Any hints/solutions/workarounds/comments appreciated! 🙂 Thanks!

<UserControl x:Class="TestApplication.UserControl1"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             d:DesignHeight="768" d:DesignWidth="1280" mc:Ignorable="d">
    <UserControl.Resources>
        <ResourceDictionary>
            <!-- [removed for clarity] -->
        </ResourceDictionary>
    </UserControl.Resources>

    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="{Binding ElementName='uiCustomerOrderListView', Path='ActualWidth'}" />
            <ColumnDefinition Width="5" />
            <ColumnDefinition Width="{Binding ElementName='uiPackagingOrderListView', Path='ActualWidth'}" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <Label
            BorderBrush="Black"
            BorderThickness="1"
            Content="Customer Orders"
            FontWeight="Bold"
            Grid.Column="0"
            Grid.Row="0"
            HorizontalContentAlignment="Center"
            Margin="0,0,0,2"
            SnapsToDevicePixels="True"
            VerticalContentAlignment="Center" />
        <Label
            BorderBrush="Black"
            BorderThickness="1"
            Content="Packaging Orders"
            FontWeight="Bold"
            Grid.Column="2"
            Grid.Row="0"
            HorizontalContentAlignment="Center"
            Margin="0,0,0,2"
            SnapsToDevicePixels="True"
            VerticalContentAlignment="Center" />

        <Grid
            Grid.Column="0"
            Grid.Row="1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="4" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="4" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>

            <TextBlock
                x:FieldModifier="private"
                x:Name="uiCustomerOrdersColumn00HeaderTextBlock"
                FontWeight="Bold"
                Grid.Column="1"
                Grid.Row="0"
                Text="[Order No.]"
                TextAlignment="Center"
                TextTrimming="CharacterEllipsis"
                ToolTip="" />
            <!-- [similar TextBlocks for columns 2, 3, 4, 5, 6] -->
            <!-- [removed for clarity] -->
        </Grid>

        <Grid
            Grid.Column="2"
            Grid.Row="1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="4" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="4" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>

            <TextBlock
                x:FieldModifier="private"
                x:Name="uiPackagingOrdersColumn00HeaderTextBlock"
                FontWeight="Bold"
                Grid.Column="1"
                Grid.Row="0"
                Text="[Order Nr.]"
                TextAlignment="Center"
                TextTrimming="CharacterEllipsis"
                ToolTip="" />
            <!-- [similar TextBlocks for columns 2, 3, 4, 5, 6, 7] -->
            <!-- [removed for clarity] -->
        </Grid>

        <Border
            BorderBrush="Black"
            BorderThickness="0,2,0,0"
            Grid.Column="0"
            Grid.ColumnSpan="4"
            Grid.Row="2"
            Margin="1,1,1,1"
            SnapsToDevicePixels="True" />

        <ScrollViewer
            Grid.Column="0"
            Grid.ColumnSpan="4"
            Grid.Row="3"
            HorizontalScrollBarVisibility="Disabled"
            VerticalScrollBarVisibility="Visible">

            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="5" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>

                <ListView
                    x:FieldModifier="private"
                    x:Name="uiCustomerOrderListView"
                    Grid.Column="0"
                    Grid.Row="1"
                    ItemsSource="{Binding Path='.'}"
                    ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                    ScrollViewer.VerticalScrollBarVisibility="Disabled"
                    SelectionMode="Single"
                    VirtualizingStackPanel.IsVirtualizing="False">
                    <ListView.View>
                        <GridView
                            x:FieldModifier="private"
                            x:Name="uiCustomerOrderGridView"
                            AllowsColumnReorder="False">
                            <GridView.Columns>
                                <GridViewColumn />
                                <GridViewColumn />
                                <GridViewColumn />
                                <GridViewColumn />
                                <GridViewColumn />
                                <GridViewColumn />
                            </GridView.Columns>
                        </GridView>
                    </ListView.View>
                </ListView>

                <ListView
                    x:FieldModifier="private"
                    x:Name="uiPackagingOrderListView"
                    Grid.Column="2"
                    Grid.Row="1"
                    ItemsSource="{Binding Path='.'}"
                    ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                    ScrollViewer.VerticalScrollBarVisibility="Disabled"
                    SelectionMode="Single"
                    VirtualizingStackPanel.IsVirtualizing="False">
                    <ListView.View>
                        <GridView
                            x:FieldModifier="private"
                            x:Name="uiPackagingOrderGridView"
                            AllowsColumnReorder="False">
                            <GridView.Columns>
                                <GridViewColumn />
                                <GridViewColumn />
                                <GridViewColumn />
                                <GridViewColumn />
                                <GridViewColumn />
                                <GridViewColumn />
                                <GridViewColumn />
                            </GridView.Columns>
                        </GridView>
                    </ListView.View>
                </ListView>
            </Grid>
        </ScrollViewer>
    </Grid>
</UserControl>
  • 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-06-09T06:21:38+00:00Added an answer on June 9, 2026 at 6:21 am

    It’s because you’re binding the width of your top grid (Customer orders/Packaging orders) to the actual width of other controls, so it goes through a ton of updates as you resize. To fix it in my test harness and keep the same look, I did the following:

    Set the first grid’s columns as such:

    <Grid.ColumnDefinitions>
         <ColumnDefinition Width="*" />            
         <ColumnDefinition Width="*" />
         <ColumnDefinition Width="18"/>
    </Grid.ColumnDefinitions>
    

    I then modified your second label to set the Grid.Column property to 1 instead of 2. This gives you the same overall look. I will say though that you use a lot of grids and could probably simplify this design some. Here is my version of your code in it’s entirety:

    <Grid>
         <Grid.ColumnDefinitions>
         <ColumnDefinition Width="*" />            
         <ColumnDefinition Width="*" />
         <ColumnDefinition Width="18"/>
      </Grid.ColumnDefinitions>
         <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
         </Grid.RowDefinitions>
    
         <Label
            BorderBrush="Black"
            BorderThickness="1"
            Content="Customer Orders"
            FontWeight="Bold"
            Grid.Column="0"
            Grid.Row="0"
            HorizontalContentAlignment="Center"
            Margin="0,0,0,2"
            SnapsToDevicePixels="True"
            VerticalContentAlignment="Center" />
         <Label
            BorderBrush="Black"
            BorderThickness="1"
            Content="Packaging Orders"
            FontWeight="Bold"
            Grid.Column="1"
            Grid.Row="0"
            HorizontalContentAlignment="Center"
            Margin="0,0,0,2"
            SnapsToDevicePixels="True"
            VerticalContentAlignment="Center" />
    
         <Grid
            Grid.Column="0"
            Grid.Row="1">
            <Grid.ColumnDefinitions>
               <ColumnDefinition Width="4" />
               <ColumnDefinition Width="*" />
               <ColumnDefinition Width="*" />
               <ColumnDefinition Width="*" />
               <ColumnDefinition Width="*" />
               <ColumnDefinition Width="*" />
               <ColumnDefinition Width="*" />
               <ColumnDefinition Width="4" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
               <RowDefinition Height="*" />
            </Grid.RowDefinitions>
    
            <TextBlock
                x:FieldModifier="private"
                x:Name="uiCustomerOrdersColumn00HeaderTextBlock"
                FontWeight="Bold"
                Grid.Column="1"
                Grid.Row="0"
                Text="[Order No.]"
                TextAlignment="Center"
                TextTrimming="CharacterEllipsis"
                ToolTip="" />
            <!-- [similar TextBlocks for columns 2, 3, 4, 5, 6] -->
            <!-- [removed for clarity] -->
         </Grid>
    
         <Grid
            Grid.Column="2"
            Grid.Row="1">
            <Grid.ColumnDefinitions>
               <ColumnDefinition Width="4" />
               <ColumnDefinition Width="*" />
               <ColumnDefinition Width="*" />
               <ColumnDefinition Width="*" />
               <ColumnDefinition Width="*" />
               <ColumnDefinition Width="*" />
               <ColumnDefinition Width="*" />
               <ColumnDefinition Width="*" />
               <ColumnDefinition Width="4" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
               <RowDefinition Height="*" />
            </Grid.RowDefinitions>
    
            <TextBlock
                x:FieldModifier="private"
                x:Name="uiPackagingOrdersColumn00HeaderTextBlock"
                FontWeight="Bold"
                Grid.Column="1"
                Grid.Row="0"
                Text="[Order Nr.]"
                TextAlignment="Center"
                TextTrimming="CharacterEllipsis"
                ToolTip="" />
            <!-- [similar TextBlocks for columns 2, 3, 4, 5, 6, 7] -->
            <!-- [removed for clarity] -->
         </Grid>
    
         <Border
            BorderBrush="Black"
            BorderThickness="0,2,0,0"
            Grid.Column="0"
            Grid.ColumnSpan="4"
            Grid.Row="2"
            Margin="1,1,1,1"
            SnapsToDevicePixels="True" />
    
         <ScrollViewer
            Grid.Column="0"
            Grid.ColumnSpan="4"
            Grid.Row="3"
            HorizontalScrollBarVisibility="Disabled"
            VerticalScrollBarVisibility="Visible">
    
            <Grid>
               <Grid.ColumnDefinitions>
                  <ColumnDefinition Width="*" />
                  <ColumnDefinition Width="5" />
                  <ColumnDefinition Width="*" />
               </Grid.ColumnDefinitions>
               <Grid.RowDefinitions>
                  <RowDefinition Height="*" />
               </Grid.RowDefinitions>
    
               <ListView
                    x:FieldModifier="private"
                    x:Name="uiCustomerOrderListView"
                    Grid.Column="0"
                    Grid.Row="1"
                    ItemsSource="{Binding Path='.'}"
                    ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                    ScrollViewer.VerticalScrollBarVisibility="Disabled"
                    SelectionMode="Single"
                    VirtualizingStackPanel.IsVirtualizing="False">
                  <ListView.View>
                     <GridView
                            x:FieldModifier="private"
                            x:Name="uiCustomerOrderGridView"
                            AllowsColumnReorder="False">
                        <GridView.Columns>
                           <GridViewColumn />
                           <GridViewColumn />
                           <GridViewColumn />
                           <GridViewColumn />
                           <GridViewColumn />
                           <GridViewColumn />
                        </GridView.Columns>
                     </GridView>
                  </ListView.View>
               </ListView>
    
               <ListView
                    x:FieldModifier="private"
                    x:Name="uiPackagingOrderListView"
                    Grid.Column="2"
                    Grid.Row="1"
                    ItemsSource="{Binding Path='.'}"
                    ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                    ScrollViewer.VerticalScrollBarVisibility="Disabled"
                    SelectionMode="Single"
                    VirtualizingStackPanel.IsVirtualizing="False">
                  <ListView.View>
                     <GridView
                            x:FieldModifier="private"
                            x:Name="uiPackagingOrderGridView"
                            AllowsColumnReorder="False">
                        <GridView.Columns>
                           <GridViewColumn />
                           <GridViewColumn />
                           <GridViewColumn />
                           <GridViewColumn />
                           <GridViewColumn />
                           <GridViewColumn />
                           <GridViewColumn />
                        </GridView.Columns>
                     </GridView>
                  </ListView.View>
               </ListView>
            </Grid>
         </ScrollViewer>
      </Grid>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

don't know better title for this, but here's my code. I have class user
Don't ask me how but I'm in a situation where I have DCPs published
Don't be scared of the extensive code. The problem is general. I just provided
Don't ask me why but I need to do the following: string ClassName =
I don't know why, but this code worked for me a month ago... maybe
Don't they both have to convert to machine code at some point to execute
Don't ask why but I have the requirement to draw a border around certain
Don't know if this is an eclipse specific problem but whenever I declare a
Don't ask me how but I managed to get accidentally the following remote branches
DON'T ASK WHY but... I have a regex that needs to be case insensitive

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.