John Palmieri

John Palmieri

  • NA
  • 13
  • 549

Scrollbar resets to selected checkbox

Jan 25 2021 4:09 PM
I have set up a Grid inside a ScrollViewer. At runtime, based on the results of a search I dynamically build a number of checkboxes which I add as Children to the Grid. This all works fine.
 
But, when I select a CheckBox, the ScrollViewer moves and places the checked box to the top of the view.
 
For instance, if the box I want to check is in the middle of the view, when I check it, it moves to the top of the view while its place in the overall list remains the same.
 
<ScrollViewer Grid.Row="0" Margin="5,5,5,5" VerticalScrollBarVisibility="Visible" >
<Grid x:Name="InnerGrid1" >
</Grid>
</ScrollViewer>

Answers (3)