Solved

WPF Iterate over listboxitems

Posted on 2008-06-19
1
325 Views
Last Modified: 2013-11-26
I have a listbox in wpf bound to a custom object.  When I hit a "save" button, I want to iterate all the listboxitems and pull my object out of it so I can push to a db.  How can I do this?  I've tried casting the listboxitem as my object, but that doesn't work.
0
Comment
Question by:sgildner
1 Comment
 
LVL 11

Accepted Solution

by:
CMYScott earned 500 total points
ID: 21827903
as you add the listboxitems to the listbox, set the tag property for each item to the object that item represents - then when you handle the save event, grab the tag value - cast it as your object and you should have what you want.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question