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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:56:21+00:00 2026-05-26T08:56:21+00:00

I have a strange problem with Polyline class and it Points property. When I

  • 0

I have a strange problem with Polyline class and it Points property. When I set the Points property in XAML explicitly it renders ok, later in code behind, for example I change the first point and it refresh the UI correctly.

<Polyline Name="plLine" Points="0 0 100 100 100 200 200 200"
                      Stroke="Black"
                      StrokeThickness="1" />

and later in code behind:

private void Button2_Click(object sender, RoutedEventArgs e)
{
    plLine.Points[0] = new Point(10, 10);    
}

everithing ok with that.

However when I bind Points property with the same data from my ViewModel, for instance:

<Polyline Name="plLine" Points="{Binding PointCollection}"
                      Stroke="Black"
                      StrokeThickness="1" />

and try to execute my code behind it does not refresh what is rendered.

Why this behavior?

  • 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-26T08:56:22+00:00Added an answer on May 26, 2026 at 8:56 am

    You are breaking the binding here. You have binded your points to property PointCollection and there after you are setting it from your code behind thereby overriding the binding. Afterwards, when you change the PointCollection in your ViewModel no change will be notice in your view even if you have implemented INotifyPropertyChanged for your class.

    You can try this small sample for this –

    • Place a textbox on your view and bind it’s text property to some property in your viewmodel say value for this property is “Test”
    • Now place two button’s on your view.
    • On first button click simply set the text of your textbox to something say “Button1”.
    • You will notice that textbox text will now be “Button1”.
    • Now on second button click, try to set your Viewmodel property to say “Button2”. PropertyChanged will be fired but you won’t notice any change in your textbox text.

    Since the binding has been broken by explicitly setting the Text property of your textbox.

    So, you should always set your binded property via its source. In your case simply set the property PointCollection of your Viewmodel with INPC in place to see changes on view.

    Edit:
    Since its binded to PointCollection property that’s why changing the single value in collection won’t update it on UI. You have to completely remove the binding by setting it to new PointCollection Value. You can’t have both at same time. Look at this piece of code –

    private void Button_Click(object sender, RoutedEventArgs e)
    {
      List<Point> pts = new List<Point>();
      pts.Add(new Point(20, 20));
      pts.Add(new Point(100, 100));
      pts.Add(new Point(100, 200));
      pts.Add(new Point(200, 200));
      this.plLine.Points = new PointCollection(pts);
      //this.plLine.SetCurrentValue(Polyline.PointsProperty, new PointCollection(pts));
    }
    

    You need to set it to entirely to new collection. In case you want your binding not to be broken by setting directly as i mentioned above, uncomment my last line and comment the second last line. That way your binding will remain intact.

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

Sidebar

Related Questions

I have a strange problem in my project. I have a class that inherits
I have strange problem. I have class which behaves similar dropdown list. package test.view;
I have a strange problem, I'm using the code below to test for a
I have strange problem. I set a JProgressBar: private JProgressBar progressBar; public void foo()
I have a strange problem regarding null pointer exception. I'm posting the problematic code
I have a strange problem with Jquery Ajax with the following code. Situation 1:
I have strange problem with XUL layouts. My current code: <xul:vbox> <xul:hbox> .. some
I have a strange problem when using Entity Framework code first. When I return
I have strange problem with sharepoint and ajax functionality. We have an UpdatePanel placed
i have strange problem doing reporting: i have numerous clients with different issued invoices.

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.