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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T22:34:38+00:00 2026-05-17T22:34:38+00:00

I have a chart control in XAML, and datapoints that are bind to the

  • 0

I have a chart control in XAML, and datapoints that are bind to the control.
The problem is when my ModelView changes the Collection of points the Chart control doesn’t get any notifications. I have tried dp, with ObservableCollection and INotifyPropertyChanged without any luck. I know that there is a difference between changing a field/property and making collection operations such as (add/remove/replace etc.) for the changes to propagate to the Chart control. But I haven’t got it to work. The change event is only triggered when I instance/reinstance the collection.

Does any have link to a working MVVM that works with collections?

Worth too know.


public class ObservableCollection : Collection, INotifyCollectionChanged, INotifyPropertyChanged


        public static DependencyProperty WorkModelsProperty = DependencyProperty.Register("WorkModels", typeof(ObservableCollection), typeof(Chart),
            new PropertyMetadata(new ObservableCollection { }, new PropertyChangedCallback(
            (sender, args) =>
            {
                Debugger.Break(); //trigged only when collection got new instance
            })));

        public ObservableCollection WorkModels
        {
            get { return (ObservableCollection)GetValue(WorkModelsProperty); }
            set { SetValue(WorkModelsProperty, value); }
        }

The binding is correct and tested.
Code in Window.Resources.

ObjectDataProvider ObjectType="{x:Type vm:ListWorkViewModel}" x:Key="ListWorkViewModel"

The binding of control.


WorkModels="{Binding Source={StaticResource ListWorkViewModel}, Path=WorkModels}"

In the ViewModel I use the following code to rise changes. (When using INotifyPropertyChanged)

WorkModels.Add(workModel);
this.RaisePropertyChanged("WorkModels");

protected void RaisePropertyChanged(string propertyName)
{
     VerifyPropertyName(propertyName);
     if (PropertyChanged != null)
          PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}

When I use ObservableCollection I only add new data point to the collection.

WorkModels.Add(workModel);

Question on MVVM pattern on WPF?

  • 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-17T22:34:39+00:00Added an answer on May 17, 2026 at 10:34 pm

    Thank you for answers. I found the solution to the problem here.
    http://msdn.microsoft.com/en-us/library/aa970563.aspx

    For a dependency property in general, the implementation pattern that you follow is that you define a CLR property wrapper, where that property is backed by a DependencyProperty identifier rather than a field or other construct. You follow this same pattern when you implement a collection-type property. However, a collection-type property introduces some complexity to the pattern whenever the type that is contained within the collection is itself a DependencyObject or Freezable derived class.

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

Sidebar

Related Questions

i have problem to correctly bind data to WPF Chart. When i'm setting ItemsSource
I have my own derived WPF DataVisualization chart control and within that control, I
So, I have a WindowsFormsHost control in my WPF app (hosting a Dundas Chart)
I have a chart with a series that denotes a large set (1000's) of
I have a chart (in bitmap format) that I'm trying to render to a
I have some code that generates image of a pie chart. It's a general
I am looking for a nice control that allows me to have a shopping
i have an ms chart control. i would like to be able to scale
i have an ms chart control on the form and i would like to
I have custom control - chart with size, for example, 300x300 pixels and more

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.