[IronPython] WPF / ipy: renewing data binding? Could use some guidance.

Ken MacDonald drken567 at gmail.com
Wed Aug 18 17:35:46 CEST 2010


I have inherited a WPF/ipy app which is using data binding / CollectionView
to interact with a customer list. Steps are roughly:

1. query cust. list from DB, sorted by name
2. bind this to a CollectionView
3. step through the list, displaying 1 cust. at a time using the
CollectionView.Next/Previous (forget the exact name) operators,
    moved thru the list in alpha-sorted order
4. re-sort the list by, say, customer type. Still moves thru the list with
Next/Previous except now sorted by type, no longer by alpha.
    Perfect so far, but............

5. New customers (maybe) have been added to the DB. I re-query the customer
list to pick up any new ones. The new list is sorted by  customer type
(remembered my last sort criteria).
6. bind this to a CollectionView.
7. step thru the list, using Next/Previous on the CollectionView. The
customers appear in *utterly random order*, not by alpha, not by customer
type.

So, I'm a bit stymied. I've been looking through the MSDN but haven't seen
anything that addresses how to update CollectionView/data binding to reflect
new data in the customer list, or whether it is, in fact, possible to do so.
I've found a couple of hints, and tried dozens of variations on the code
that seems like it should "just work". It's quite tempting to just maintain
my own lists and navigation in python.

I've deliberately NOT included any code; for one thing, it's scattered over
a number of modules of python (and XAML) but am interested in how any of you
would approach the re-binding-to-new-data problem; also, if any of you tried
it and found it equally as bizarre and arcane and impossible as it seems to
be for my app.
Thanks!
Ken
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20100818/08bf6e49/attachment.html>


More information about the Ironpython-users mailing list