Click here to Skip to main content
13,086,120 members (84,106 online)
Rate this:
Please Sign up or sign in to vote.
See more:
How can I get the scrolled item of Scrollviewer in WPF..?

I have assigned a List to Scrollviewer Content but want to get Scrolled item which is coming to ScrollintoView(?(index)),hence want to get front coming item cause i want to set index of Combobox according to scrolled item of Scrollviewer..
Posted 18-Apr-11 22:53pm
Updated 18-Apr-11 23:05pm
Tarun.K.S 19-Apr-11 5:11am
Are you using a ListBox inside the ScrollViewer?
Vinod Salunke 21-Apr-11 10:15am
First Thanks for replying.
i am using stackpanel inside and while scrolling first touches the current seeing item and dont know how much items get scrolled. issue is to get scroll completed item and set to other...

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

There is not such thing, and it would not make any sense.

Think by yourself. There is a property System.Windows.Controls.ContentControl.Content; something which is always in view, usually partially (because this is a purpose of System.Windows.Controls.ScrollViewer). Everything else fully depends on what is placed inside Content. You can always arrange controls inside ScrollViewer.Content and the size of ScrollViewer the way more than one control is always in the view. Which one would you consider as a "scrolled item"?

You can always calculate what part of control is currently visible based on ScrollViewer size, its scroll position and actual position/size of the control in question.

Espen Harlinn 19-Apr-11 16:26pm
Good points, my 5
SAKryukov 19-Apr-11 16:26pm
Thank you, Espen.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.170813.1 | Last Updated 8 Jan 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100