Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 256459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T22:00:57+00:00 2026-05-11T22:00:57+00:00

I’m struggling for quite some time now with binding my ListView to a table.

  • 0

I’m struggling for quite some time now with binding my ListView to a table. I’ve read various solutions, but I keep running into trouble.

I have 2 database tables: Customers and Products. For each Customer there is a list of Products.

In my first attempt I bind to the generated Linq-to-SQL code. That means I binding immediately to Customer.Products. But since this is of type System.Data.Linq.EntitySet<Product>, I don’t get notified when items are added to/removed from the database.

So I extended the generated code by adding a method to Customer that wraps the returned System.Data.Linq.EntitySet<Product> in an ObservableCollection (as adviced by various blogs)

public ObservableCollection<Product> ObservableProducts
{
    get
    {
        return new ObservableCollection<Product>(Products);
    }
}

But now I cannot add anything to the collection. When I call ObservableProducts.Add() nothing is added..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T22:00:57+00:00Added an answer on May 11, 2026 at 10:00 pm

    An ObservableCollection is not a view on an underlying collection – it is a collection in its own right. When you pass the List to the ObservableCollection, the items in the List are copied to the ObservableCollection.

    So your item is being added, but only to the ObservableCollection – not the underlying List you passed to it.

    Options for moving forward include:

    • Using an ObservableCollection in your data layer. Convert the entity list to an ObservableCollection straight away and use that throughout the application.
    • Listening for changes to the ObservableCollection and applying those changes to the underlying List.
    • Write an implementation of INotifyCollectionChanged that is a view on an underlying collection. This can only work one-way (OC->List but not List->OC) and gets tricky if you have a multithreaded application.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
I need to clean up various Word 'smart' characters in user input, including but
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.