[IronPython] WPF Question

Davy Mitchell daftspaniel at gmail.com
Sat May 3 22:03:05 CEST 2008


Thanks Curt - turns out the selected listbox entry in the VB app was a
ListBoxItem (added in the designer),so of course they would be different. I
forgot to check the XAML file... Doh! :-)

Davy

On Sat, May 3, 2008 at 3:46 AM, Curt Hagenlocher <curt at hagenlocher.org>
wrote:

> If you add strings to the Items collection, then SelectedItem will contain
> strings.  If you want the ListBoxItem, you have to do something like this:
> listbox.ItemContainerGenerator.ContainerFromIndex(listbox.SelectedIndex)
>
> This is true for both VB and IronPython because it's a function of the WPF
> control.
>
> On Fri, May 2, 2008 at 12:49 PM, Davy Mitchell <daftspaniel at gmail.com>
> wrote:
>
> > First - yay a new release well done ;-)
> >
> > Now a WPF Question...
> >
> > I am using a listbox and in VB.net used TheLisbox.SelectedItem.Content
> > to get the string selected.
> >
> > Try this with IronPython (and after an impressively long traceback) the
> > error is 'AttributeError: 'str' object has no attribute 'Content''.
> >
> > So IP has converted the 'Object' of SelectedItem straight to a string -
> > handy for me but shouldn't it be a ListBoxItem?
> >
> > Thanks,
> > Davy
> >
> > --
> > Davy Mitchell
> > Blog - http://www.latedecember.co.uk/sites/personal/davy/
> > Twitter - http://twitter.com/daftspaniel
> > Skype - daftspaniel http://needgod.com
> > _______________________________________________
> > Users mailing list
> > Users at lists.ironpython.com
> > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> >
> >
>
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>


-- 
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel http://needgod.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20080503/47ae8e19/attachment.html>


More information about the Ironpython-users mailing list