Solved

WPF Iterate over listboxitems

Posted on 2008-06-19
1
327 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

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

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

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
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…

679 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