Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: WPF Silverlight
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 23:53pm
Edited 19-Apr-11 0:05am
jim lahey24.9K
v2
Comments
Tarun.K.S at 19-Apr-11 5:11am
   
Are you using a ListBox inside the ScrollViewer?
Vinod Salunke at 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
good
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.
 
—SA
  Permalink  
v2
Comments
Espen Harlinn at 19-Apr-11 16:26pm
   
Good points, my 5
SAKryukov at 19-Apr-11 16:26pm
   
Thank you, Espen.
--SA

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

  Print Answers RSS
0 Kornfeld Eliyahu Peter 169
1 Zoltán Zörgő 139
2 George Jonsson 135
3 PIEBALDconsult 130
4 OriginalGriff 120
0 OriginalGriff 6,165
1 DamithSL 4,658
2 Maciej Los 4,107
3 Kornfeld Eliyahu Peter 3,649
4 Sergey Alexandrovich Kryukov 3,342


Advertise | Privacy | Mobile
Web03 | 2.8.141220.1 | Last Updated 8 Jan 2012
Copyright © CodeProject, 1999-2014
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