C# WPF Datagrid

Hi,

I have a WPF application that contains a datagrid. The datagrid is binded to my object "OrderList" (please see the code block below).

I need to know when a user deletes a row in the datagrid. I then intend to move this deleted row to my other List "OrderListFailed" which is bound to a different datagrid.

As always any help would be great.

Thanks,
M

public class OrderBlock
    {
        public string BlockID { get; set; }
        public int NumFails { get; set; }
        public List<Orders> OrderList { get; set; }
        public List<Orders> OrderListFailed { get; set; }
    }

    public class Orders
    {
        public bool Failed { get; set; }
        public string Name { get; set; }
        public string ID { get; set; }
        public string Side { get; set; }
        public double Amount { get; set; }
        public bool GoodOrder { get; set; }
    } 

Open in new window

mcs26Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bob LearnedCommented:
I haven't done this specifically, but you might want to think about an ObservableCollection, that can detect when an item is removed, and then copy that item to another ObservableCollection for the other grid.

Using the WPF ObservableCollection with EF Entities
http://blogs.msdn.com/b/bethmassi/archive/2009/05/08/using-the-wpf-observablecollection-with-ef-entities.aspx

protected override void RemoveItem(int index)
{
	this.Context.DeleteObject(this(index));
	base.RemoveItem(index);
}

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.