Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

WPF Iterate over listboxitems

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

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

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

Summary Displaying images in RichTextBox is a common requirement with limited solutions available. Pasting through clipboard or embedding into RTF content only support static images.  This article describes how to insert Windows control objects int…
The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
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…

856 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