开发者

Jittery or Slow scrolling with multiple Expanders in a ScrollViewer and Grid

开发者 https://www.devze.com 2023-03-03 16:06 出处:网络
In a couple of our applications, we commonly need to show a lot of data together on the screen, but put this content in expanders so the user can determine what they want to see or do not want to see

In a couple of our applications, we commonly need to show a lot of data together on the screen, but put this content in expanders so the user can determine what they want to see or do not want to see at that time.

Ive noticed that when I try to use similar code below, the scrolling either is jumpy or just slower than it should be, on a decent machine too.

<ScrollViewer x:Name="sbar" Grid.Row="1" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" VerticalAlignment="Top">
     <Grid>
          <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition开发者_高级运维 Height="Auto" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>

<Expander x:Name="ex1" Style="{DynamicResource GroupBoxExpander}" Width="900" HorizontalAlignment="Left" Margin="5" Grid.Row="0" Grid.Column="0" IsExpanded="True">
     <StackPanel></StackPanel>
</Expander>

<!-- in my current application, 9 more in between -->

<Expander x:Name="ex11" Style="{DynamicResource GroupBoxExpander}" Width="900" HorizontalAlignment="Left" Margin="5" Grid.Row="0" Grid.Column="0" IsExpanded="True">
     <StackPanel></StackPanel>
</Expander>
        </Grid>
    </ScrollViewer>

In this example I don't actually need to use the grid so much anymore, but one of our other applications will still need a grid. Also there is content in all the expanders, ranging from textboxes to listviews and other controls, but not to many, and some range greatly.

What could we do to speed this up a little? There really isn't much databinding going on behind the scenes on it, and we dont


remove unnecessary rows from grid and try it out.


I removed as many extra things (like Grids and some stack panels not being used), and didn't really see a performance increase. I did notice however, on the machines this code will eventually run on (using a lower resolution monitor), the performance was much better. This issue is tied it looks like to the visual items available on the screen, and an edge case in my current issue.

Therefore I think the best answer is to redesign the interface and user experience is the best route to go here.

0

精彩评论

暂无评论...
验证码 换一张
取 消