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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T18:42:23+00:00 2026-05-12T18:42:23+00:00

This will probably be obvious but I can’t find the best way. I want

  • 0

This will probably be obvious but I can’t find the best way.

I want to show the user’s ToDo’s in a listbox. These ToDo’s are in the database and consist of an Id, UserId and Description.

The user logged in to the app.

How can I retrieve the ToDo’s for that certain userId and set it up for binding to the listbox?

I was trying with an ObjectDataProvider but I cant figure out how to use that in combination with nonstatic stuff (like my _dbService, userId, language, …).

Are the only options to make all those things static versus binding in the code behind?

If so, this means that ObjectDataProvider isn’t very useful, no?
I find a lot of examples of it being used with a hardcoded parameter but I hardly see any situation where I’d need such a functionality..

  • 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-12T18:42:23+00:00Added an answer on May 12, 2026 at 6:42 pm

    I do all my WPF using the Model-View-ViewModel pattern. I’ve given you one link there but Google will give you loads. MVVM seems to be the standard pattern for WPF. This project is probably more complicated than you need but it is well-written and brings home the use of MVVM.

    Basically, you create a Model of your data. In this case, you’d probably create a simple class (I’ll call it ToDoItem) with properties Id, UserID and Description. Use your preferred mechanism to get a collection of these from the database. Link to SQL, Entity Framework, a standard query, whatever.

    Then you have your ViewModel – you have an instance of the ViewModel for each instance of the Model: the VM has a reference to the M and ‘forwards’ properties to it. The ViewModel is what you use to manipulate the model.

    Then you have your View – this is the UI. You set the DataContext of the View to be the ViewModel and then your bindings automatically bind to the ViewModel. Your View just ends up being the things you can see. All of the work gets done in the ViewModel. This means it’s very easy to test.

    So, when you click on a button in your View, the bindings pass this onto a Command in your ViewModel which manipulates the Model.

    The UI is also a View with a ViewModel. So, your UI VM might load a collection of Models from the database and stick them in an ObservableCollection. The ListBox items collection would be bound to this ObservableCollection.

    It’s hard to explain all of this in a post like this. Read a couple of articles and see what you think. I’m still quite new at this, too, but I believe my reading about MVVM has paid off.

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

Sidebar

Related Questions

This will probably sound stupid, but I can't figure out what's happening and it's
This will probably be a bot of a waffly question but ill try my
This will probably be just another unsolved thread but i'll fill in some info
It probably isn't even possible to do this, but I will ask anyway. Is
Apologies in advance for what's probably an obvious question but I don't want to
This is probably one of those questions with an obvious answer, but when I
Complete beginner so I'm probably missing something obvious but... I can't seem to combine
This is probably a question with a blindingly obvious answer. I just can't see
This is confusing me, so this question will probably be confusing. I have a
This is a very newbie question and i will probably get downvoted for it,

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.