How to fix a flickering issue caused by the graphs adjusting their width when the scrollbar appears while resizing the application width?

laxmi swami 1 Reputation point
2025-05-09T05:48:25.2466667+00:00

I have set HorizontalScrollBarVisibility="Auto" in my WPF application. My grid contains two graphs that adjust their height and width dynamically. However, when resizing the screen to a certain width where the scrollbar appears, the screen starts flickering due to the graph resizing.

Ideally the graphs should maintain a stable size and prevent excessive flickering when the scrollbar appears.

so how can i avoid flickering and what are best practices for handling dynamic resizing in this scenario?

<Grid Grid.Row="1"> <Grid.ColumnDefinitions> <ColumnDefinition Width="*"></ColumnDefinition> <ColumnDefinition Width="*"></ColumnDefinition> </Grid.ColumnDefinitions> <ContentControl Grid.Column="{Binding LeftPanelColumn}" FocusVisualStyle="{x:Null}" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" Content="{Binding LeftGraph, UpdateSourceTrigger=PropertyChanged}" /> <ContentControl Grid.Column="{Binding RightPanelColumn}" FocusVisualStyle="{x:Null}" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" Content="{Binding RightGraph, UpdateSourceTrigger=PropertyChanged}" /> </Grid>

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,465 questions
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.