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

The Archive Base Latest Questions

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

In WPF Databinding, I understand that you have DataContext which tells an element what

  • 0

In WPF Databinding, I understand that you have DataContext which tells an element what data it is going to bind to and ItemsSource which ‘does the binding’.

But e.g. in this simple example it doesn’t seem that ItemsSource is doing anything useful since, what else would you want the Element to do to the DataContext except bind to it?

<ListBox DataContext='{StaticResource customers}'           ItemsSource='{Binding}'> 

And in more complex examples of ItemsSource, you have Path and Source which seems to be encroaching on the territory of DataContext.

ItemsSource='{Binding Path=TheImages, Source={StaticResource ImageFactoryDS}}' 

What is the best way to understand these two concepts as to know when and how to apply each of them in various coding scenarios?

  • 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. 2026-05-11T15:17:58+00:00Added an answer on May 11, 2026 at 3:17 pm

    DataContext is just a handy way to pick up a context for bindings for the cases where an explicit source isn’t specified. It is inherited, which makes it possible to do this:

    <StackPanel DataContext='{StaticResource Data}'>     <ListBox ItemsSource='{Binding Customers}'/>     <ListBox ItemsSource='{Binding Orders}'/> </StackPanel> 

    Here, Customers and Orders are collections on the resource called ‘Data’. In your case, you could have just done this:

    <ListBox ItemsSource='{Binding Source={StaticResource customers}}'/> 

    since no other control needed the context set.

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

Sidebar

Related Questions

I have a very simple WPF application in which I am using data binding
I'm new to WPF data binding. I have a ListBox on a form that
I have a situation where I am using wpf data binding and validation using
I am just starting out with WPF and am trying to understand data binding.
I'm experimenting with databinding in WPF I have this datagrid that is bound to
In WPF: Can someone please explain the relationship between DependencyProperty and Databinding? I have
I have a WPF form and I am working with databinding. I get the
I'm new to WPF and data binding so hopefully I can explain the problem
I'm working through the Data Binding chapter in Pro WPF in C# 2008. They
Just learning WPF databinding and have a gap in my understanding. I've seen a

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.