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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:34:56+00:00 2026-06-18T08:34:56+00:00

I want that figSpeed always reflets pSpeed but when I come to binding in

  • 0

I want that figSpeed always reflets pSpeed but when I come to binding in onChangeX method, I get always a System.NullReferenceException

Anyone can help me? Seems the reference is correct and so is the case.

PointsToPathConverter class:

[ValueConversion(typeof(List<Point>), typeof(Geometry))]
public class PointsToPathConverter : IValueConverter
{
    #region IValueConverter Members
    public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        List<Point> points = (List<Point>)value;

        if (points.Count > 0)
        {
            Point start = points[0];
            List<LineSegment> segments = new List<LineSegment>();

            for (int i = 1; i < points.Count; i++)
            {
                segments.Add(new LineSegment(points[i], true));
            }

            PathFigure figure = new PathFigure(start, segments, false); // true if closed
            PathGeometry geometry = new PathGeometry();
            geometry.Figures.Add(figure);
            return geometry;
        }
        else
        {
            return null;
        }
    }

    public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        throw new NotSupportedException();
    }
    #endregion
}

dataProjectorVM class:

public class dataProjectorVM : INotifyPropertyChanged
{
    public event PropertyChangedEventHandler PropertyChanged;

    public Path figSpeed;
    public List<Point> pSpeed;

    public dataProjectorVM()
    {
        pSpeed = new List<Point>();
        pSpeed.Add(new Point(0, 0));
        Binding bind;

        bind = new Binding("pSpeed")
        {
            Source = this,
            Mode = BindingMode.OneWay,
            Converter = new PointsToPathConverter(),
            UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged
        };

        figSpeed = new Path()
        {
            Stroke = Brushes.Black,
            StrokeThickness = 1
        };

        figSpeed.SetBinding(Path.DataProperty, bind);
    }

    public void onChangeX()
    {
        pSpeed.Clear();
        double pm = -2;

        foreach (dataPacket dp in appMain.dataMgr.retrive.result)
        {
            double _pm = appMain.dataMgr.projector.getX(dp.pm);

            if (_pm > pm + 1)
            {
                pm = _pm;
                pSpeed.Add(new Point(pm, appMain.dataMgr.projector.getSpeedY(dp.speed)));
            }
        }

        this.PropertyChanged.Invoke(this, new PropertyChangedEventArgs("pSpeed"));
    }
}
  • 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-18T08:34:57+00:00Added an answer on June 18, 2026 at 8:34 am

    If the PropertyChanged event doesn’t have any handlers, this.PropertyChanged will be null.

    You need to check for that.

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

Sidebar

Related Questions

I want that the method showEnteredData is executed if the Button is pressed. But
I want that screenCheck function show run only after Validation of #contact_email . But
I want that the form will not close by doing Alt + F4 but
I want that when a user clicks a button in an app, they get
I'want that my box scroll down with my page but this script seem dosn't
I want that every user has a profile-url like this: www.example.com/username But my php
I want that my flash file on my website, can't be downloaded by anyone.
I want that real numbers would be for example 12.92, but not 12.9241. Is
I want that once open browser,I will get the browser's maximize (maybe the browser
I want that when I press login button I get the response back in

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.