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

  • Home
  • SEARCH
  • 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 9203015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:23:09+00:00 2026-06-17T23:23:09+00:00

I have a property on my view model which returns some hard coded test

  • 0

I have a property on my view model which returns some hard coded test data:

public ObservableCollection<Item> Items
{
  get
  {
    return new ObservableCollection<Item> {
      new Item { Key = 0, Count = 5 },
      new Item { Key = 1, Count = 3 },
      new Item { Key = 2, Count = 2 },
      new Item { Key = 3, Count = 7 }
    }
  }
}

My chart is defined in the view as:

<toolkit:WrapPanel>
  <toolkit:Chart>
    <toolkit:LineSeries ItemsSource="{Binding Items}" IndependentAxis="{Binding Key}" DependentValueBinding="{Binding Count}"/>
  </toolkit:Chart>
</toolkit:WrapPanel>

With that code, I get the following exception:

System.Windows.Data Error: BindingExpression path error: 'Key' property not found on 'Test.MyViewModel' 'Test.MyViewModel' (HashCode=50157845). BindingExpression: Path='Key' DataItem='Test.MyViewModel' (HashCode=50157845); target element is 'System.Windows.Controls.DataVisualization.Charting.LineSeries' (Name=''); target property is 'IndependentAxis' (type 'System.Windows.Controls.DataVisualization.Charting.IAxis').

If I bind the DataContext of the chart to Items, then no exception is thrown, but the chart shows no data.

edit: No, it complains about not being able to bind Key and Count on the collection instead.

All of the examples I’ve seen have their charts set up like this, so why is mine attempting to bind to the view model? Or rather, how come this appears to work for anyone else?

  • 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-17T23:23:10+00:00Added an answer on June 17, 2026 at 11:23 pm

    You probably need to use IndependentValueBinding="{Binding Key}".

    IndependentAxis specifies what type of axis you want to use – categorical, date/time, etc., not where to get the data for the axis:

    <charting:LineSeries.IndependentAxis>
       <charting:CategoryAxis Orientation="X"/>
    </charting:LineSeries.IndependentAxis>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a property in my view model which returns a constant under some
I have a view model with a property Fields which is an ObservableCollection<FieldVM> .
I have a model which has a boolean property and some other properties that
How do I bind a view model property to the ListBox.SelectedItem property? I have
I have a view model with an Email address property and a Confirm Email
I have a view with 1 dropdown generated from Model property and 3 additional
I have built a base class for my view model(s). Here is some of
I have strong-type view, I want to create link that refers to Model, which
I have a ViewModel which exposes the string property PageToolBarVisible which can be true
In my ViewModel I have a property, which is a list of models: private

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.