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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T19:16:20+00:00 2026-06-03T19:16:20+00:00

How do I get even basic binding to work between a ComboBox and an

  • 0

How do I get even basic binding to work between a ComboBox and an ObservableCollection? I can’t get anything but error messages.

VB:

Class MainWindow
    Dim Units As New ObservableCollection(Of String)

    Private Sub Window_Loaded(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles MyBase.Loaded
        Units.Clear()
        Units.Add("in")
        Units.Add("mm")
        Units.Add("cm")
    End Sub
End Class

XAML:

<Window x:Class="MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
    <ComboBox Height="59" HorizontalAlignment="Left" Margin="136,96,0,0" Name="ComboBox1" VerticalAlignment="Top" Width="319"
              ItemsSource="{Binding Units}"/>
</Grid>

No matter what I do, the ComboBox always seems to be empty and there’s an error message in the console:

System.Windows.Data Error: 40 : BindingExpression path error: ‘Units’ property not found on ‘object’ ”MainWindow’ (Name=”)’. BindingExpression:Path=Units; DataItem=’MainWindow’ (Name=”); target element is ‘ComboBox’ (Name=’ComboBox1′); target property is ‘ItemsSource’ (type ‘IEnumerable’)

  • 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-06-03T19:16:25+00:00Added an answer on June 3, 2026 at 7:16 pm

    In the XAML, change to just {Binding}, or equivalently, {Binding Path=.}:

    <ComboBox Height="59" HorizontalAlignment="Left" Margin="136,96,0,0" Name="ComboBox1" VerticalAlignment="Top" Width="319" ItemsSource="{Binding}"/>
    

    Set the Data Context explicitly to the object, from code behind, in the *Window_Loaded* event handler:

    ComboBox1.DataContext = Units;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can't even get this basic CURSOR LOOP to run in my TRANSACTION. Please
I'm new to jquery, looked at some tutorials, but I can't even get myself
I can't get intellisense to work. Even if I start with an empty project
I can't seem to get even a basic new page mode working in Conkeror.
I can't even get off the ground.I DO KNOW HOW TO ADD REFERENCES, (this.mshtml
Bit confused here, I have an on-demand instance but do I get charged even
Even though I have a fermi card(gtx 560) I get this error on VS2010:
I get the following error for the second argument even when I set the
Even using the default test code on my app I can't get this working.
No functions get called, and I can't even alert. It is just an external

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.