WPF select item in a scroll viewer
I have a ScrollViewer
with a StackPanel
that contains images. Is it possible to select items in the ScrollViewer/StackPanel开发者_JS百科?
<ScrollViewer x:Name="Gallery" Grid.Column="1" Grid.Row="0"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Visible" >
<StackPanel x:Name="GalleryStack"/>
</ScrollViewer>
How exactly? why not use a Listbox?
You should be able to use the Image.BringIntoView method to bring them into the view. But as Elad points out, what you have doesn't really implement "selection" by itself. You could handle the MouseDown event of the Image elements and call the BringIntoView method.
精彩评论