Solved

WPF Iterate over listboxitems

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
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…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now