Click here to Skip to main content
15,877,754 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Using Silverlight 4, VS 2010 and Blend 4

I have an Expander with a StackPanel and a ItemsControl where I get the collection of items I wanto to display.
<toolkit:Expander x:Name="ExpanderComentarios" Header="{Binding mySugest_Conteudo.Qt_CommentsSugestao_Info, Converter={StaticResource DescComentariosConverter}, ElementName=userControl, Mode=OneWay}" BorderThickness="0" Style="{StaticResource StyleExpanderBlue4}" d:LayoutOverrides="Height" Margin="3">
   <StackPanel x:Name="stackMySugest" Margin="0,3,0,0">
      <ItemsControl x:Name="itemsMySugest" ItemsSource="{Binding mySugest_Conteudo.ListMyComment_Info, ElementName=userControl}">
               <componente:myComent x:Name="mySugest_Comments" myComment="{Binding}"/>

The item collection has a few items, more than would fit on the screen.

This Expander is inside a ScrollViewer.

The thing is that whenever I expand the Expander or update its content the ScrollViewer scrolls down to show the last item of the Expander.

How can I prevent that scroll from hapening?
Updated 27-Feb-12 3:51am

1 solution

try this

Share this answer
Jorge J. Martins 27-Feb-12 10:13am    
The ScrollViewer control doesn't have property "CanContentScroll".
Jorge J. Martins 27-Feb-12 11:58am    
Any how, the expander is part of a UserControl witch is included in the ScrollViewer's itemscollection making It hard to manage from within the UserControl.
Dean Oliver 28-Feb-12 0:52am    
there is you not calling it correctly.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900