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 320575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T08:45:58+00:00 2026-05-12T08:45:58+00:00

Ok, this has been a head scratcher for me. I have a ListBox I

  • 0

Ok, this has been a head scratcher for me. I have a ListBox I am binding to a linq query like so:

    private IQueryable<Feed> _feeds;

    public IQueryable<Feed> Feeds
    {
        get
        {
            if (_feeds == null)
            {
                var feedsQuery = from f in _db.Feed orderby f.Title select f;
                _feeds = feedsQuery;
            }
            return _feeds;
        }
    }

    public Options()
    {
        InitializeComponent();
        this.DataContext = Feeds;
    }

(For the record I’ve also tried List, instead of IQueryable)

Everything shows up great and I have a databound form that allows you to edit a record and all of those changes work just fine, the modified data shows up in the list.

The problem comes with I add an item. Nothing shows up in the list. The data goes into the database fine, but the only way to see the data is closing and restarting my app. I’m using the code below as an example:

        Feed feed = new Feed()
        {
            ID = Guid.NewGuid(),
            Url = "http://www.test.com",
            Title = "Test"
        };
        _db.Feed.InsertOnSubmit(feed);
        _db.SubmitChanges();
        _db.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues);

(with or without the _db.Refresh nothing happens)

What’s going on?

  • 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-12T08:45:58+00:00Added an answer on May 12, 2026 at 8:45 am

    You are doing everything right, you jus need to use ObservableCollection. This will notify the ListBox about any changes in the list and refresh it automatically.

    From MSDN

    In many cases the data that you work
    with is a collection of objects. For
    example, a common scenario in data
    binding is to use an ItemsControl
    such as a ListBox, ListView, or
    TreeView to display a collection of
    records.

    P.S. you don’t need a db refresh

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This has been a head-banger for me. I have looked at all of the
Basically this has been in my head for a while... and I'd like to
This has been a rather problematic issue on numerous occasions. We have alot of
This has been driving me crazy for the past few minutes I have a
This has been bothering me lately- when I use some code like below to
This thing has been doing my head in for a little while now and
This has been a pain on my head for the past few days. I
This is a head scratcher. I have a form with a number of custom
This has been difficult to get my head around whether it's even possible, let
this problem has been doing my head in and I hope you can help!

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.