[IronPython] Strange IPY / WPF behavior on a ListBox

Jimmy Schementi Jimmy.Schementi at microsoft.com
Thu May 6 04:31:23 CEST 2010


Have you tried ListBox.ScrollIntoView(object)?

From: users-bounces at lists.ironpython.com [mailto:users-bounces at 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 <drken567 at gmail.com<mailto:drken567 at 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20100506/e966f20e/attachment.html>


More information about the Ironpython-users mailing list