Solved

move values from 1 listview to another in C# 2008 WPF

Posted on 2009-06-30
2
512 Views
Last Modified: 2013-11-11
I have a WPF C# application (NOTweb based)

I am trying to create an interface where the user gets a list of freelancers in a listview (listViewFreelancers).
They can choose freelancers and press a button (buttonSelect) which moves them into a 2nd listview (listViewSelected) to show them what they have selected.
Once they have finished selecting they will press a 2nd button (buttonSend) which will an e-mail to all of the freelancers which were selected.
_______________
I have used LINQ to SQL to bind a listview called listViewFreelancers to a LINQ query.
(there are multiple columns, the 1st column being the row_id)

I now need to take the selected rows from listViewFreelancers and move them into listViewSelected. I then need to read them out of listViewSelected so that I can e-mail them.

1) I can't figure out the code to move the selected items from 1 listview to another
2) I don't know how to read the items out of the listViewSelected once they are ready to e-mail the freelancers.

Can someone help ?

Thanks

Jon
bookITDataContext db = new bookITDataContext();

var queryFreelancers = from p in db.Freelancer_basics

             select p;
 

// binding my listview to the results of the query

this.listViewFreelancers.ItemsSource = queryFreelancers;

Open in new window

0
Comment
Question by:Jon-G
2 Comments
 
LVL 19

Expert Comment

by:daveamour
ID: 24752854
Does this help to get you started?

<Window x:Class="WpfApplication1.Window1"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    Title="Window1" Height="355" Width="477">

    <Grid>

        <ListView HorizontalAlignment="Left" Margin="107,126,0,38" Name="listView1" Width="120" />

    </Grid>

</Window>
 

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Windows;

using System.Windows.Controls;

using System.Windows.Data;

using System.Windows.Documents;

using System.Windows.Input;

using System.Windows.Media;

using System.Windows.Media.Imaging;

using System.Windows.Navigation;

using System.Windows.Shapes;
 

namespace WpfApplication1

{

    /// <summary>

    /// Interaction logic for Window1.xaml

    /// </summary>

    public partial class Window1 : Window

    {

        public Window1()

        {

            InitializeComponent();
 

            StringBuilder a = new StringBuilder("AAA");

            StringBuilder b = new StringBuilder("BBB");

            StringBuilder c = new StringBuilder("CCC");
 

            listView1.Items.Add(a);

            listView1.Items.Add(b);

            listView1.Items.Add(c);
 

            foreach (StringBuilder item in listView1.Items)

            {

                MessageBox.Show(item.ToString());

            }

        }

    }

}

Open in new window

0
 

Accepted Solution

by:
Jon-G earned 0 total points
ID: 24760964
Thanks for the response.

That much I had gotten working.
I had a mulit-column listview which I was battling to read items out of.
Eventually got it right. :)

0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
XML to SQL Table using c# 5 45
Hovering effect 9 29
Code works but how can I download the file? 20 45
Form design in vb.net 7 18
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…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

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

18 Experts available now in Live!

Get 1:1 Help Now