locked
Entity Framework: Updating collection from another window RRS feed

  • Question

  • I have a WPF application written in VB using Entity Framework. The problem is that I have a main Window that contains a ListCollectionView that displays all customer records into a listbox. I also have a Create New button which opens up another window where the user can enter information for that new customer and Save.

    How is it that I can create a new record in that new window and upon close, update the listbox in the Main Window? If it was a one window application I would have no problem. I could update, edit, delete, and save, but when it comes to opening a new window and performing those operations I am stuck. Any suggestions?

    • Moved by Alan_chen Thursday, April 21, 2011 5:44 AM WPF (From:ADO.NET Entity Framework and LINQ to Entities)
    Wednesday, April 20, 2011 2:39 AM

Answers

  • Hi MarkSA,

    Generally, you just need to pass a new instance of the item to the new window and load it with a proper data template.  Upon window closes, you can add that new item into the source of the ListCollectionView.

    Please feel free to let me know if you have any question/encounter any issue about this.

    Best regards,


    Min Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by MarkSA Monday, April 25, 2011 6:26 AM
    Thursday, April 21, 2011 6:26 AM

All replies

  • Hi,

    What I can see of your problem, it isn't exactly a Entity Framework problem, but a WPF problem you have here? Or do you get a specific EF error when trying this?

     


    --Rune
    Wednesday, April 20, 2011 1:29 PM
  • Hi MarkSA,

    Generally, you just need to pass a new instance of the item to the new window and load it with a proper data template.  Upon window closes, you can add that new item into the source of the ListCollectionView.

    Please feel free to let me know if you have any question/encounter any issue about this.

    Best regards,


    Min Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by MarkSA Monday, April 25, 2011 6:26 AM
    Thursday, April 21, 2011 6:26 AM
  • Hi MarkSA,

    We have not heard from you in a couple of days.

    Please post back at your convenience if we can assist further.

    Enjoy your day!


    Min Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, April 25, 2011 1:51 AM