Silverlight 4 Expander/ScrollViewer向下滚动以显示最后一项.怎么预防呢? [英] Silverlight 4 Expander/ScrollViewer scrolls down to show last item. How to prevent it?
问题描述
使用Silverlight 4,VS 2010和Blend 4
我有一个带有StackPanel和ItemsControl的扩展器,在其中可以获取要显示的项目集合.
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}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<componente:myComent x:Name="mySugest_Comments" myComment="{Binding}"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</toolkit:Expander>
该项目集合中有一些项目,超出了屏幕上的显示范围.
该扩展器位于ScrollViewer中.
事实是,每当我扩展Expander或更新其内容时,ScrollViewer都会向下滚动以显示Expander的最后一项.
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?
推荐答案
尝试此操作
try this
ScrollViewer.CanContentScroll="True
这篇关于Silverlight 4 Expander/ScrollViewer向下滚动以显示最后一项.怎么预防呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!