Have you tried ListBox.ScrollIntoView(object)?

From: users-boun...@lists.ironpython.com 
[mailto:users-boun...@lists.ironpython.com] On Behalf Of Ken MacDonald
Sent: Friday, April 30, 2010 12:44 PM
To: Discussion of IronPython
Subject: Re: [IronPython] Strange IPY / WPF behavior on a ListBox

Failing being able to get this working, is there a way in IPY/WPF to manually 
scroll a ListBox? I could theoretically do something like this pseudo-code:

while True:

     if my_selected_item.IsHitTestVisible():
          break
     else:
          my_selected.item.ScrollDown  <===== anything like this?
On Fri, Apr 30, 2010 at 3:08 PM, Ken MacDonald 
<drken...@gmail.com<mailto:drken...@gmail.com>> wrote:
I'm seeing some weirdness - I had a small popup dialog working in WPF/IPY where 
I had a ListBox with way too many elements to display, say about 30 or so where 
the available space would hold 4 or 5. I selected one of the elements (a 
ListBoxItem in the single selection ListBox), and executed 
BringIntoView()<http://msdn.microsoft.com/en-us/library/ms598110.aspx> on the 
ListBoxItem. Worked great, the selected item showed up.

Now, I've had to add more stuff to the dialog (an on-screen touch keyboard) and 
made the whole dialog modal; now I can't get the BringIntoView() to work. I 
have handlers on several events to try and get the BringIntoView() to happen, 
considering it has to be fired while it is Visible, and the handlers are 
getting fired, but I never see the selected item get scrolled into view. I've 
even attached handlers to some unrelated events like TextBox.TextChanged that I 
*know* are happening well after the whole dialog is rendered. Still no luck. 
Everything else in the ListBox works just as it did before, but now I can no 
longer show the 'default' item when the dialog starts. Anyone have any 
interesting clues? I've been at this most of the day trying different handlers, 
etc. and it's making no sense whatsoever.
Thanks,
Ken

_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to