开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜