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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T08:15:16+00:00 2026-06-05T08:15:16+00:00

I’ve noticed a little problem in WPF. If you two-way bind properties in a

  • 0

I’ve noticed a little problem in WPF.
If you two-way bind properties in a chain (A <-> B, B <-> C, C <-> D ...), everything is fine until you introduce two or more converters.

Now, with one converter, it still works, but when you add two converters in the chain (A <x> B, B <-> C, C <x> D ...), it can get stuck in an infinite loop, if the properties change fast enough.

It seems as if WPF is very smart about avoid infinite recursion, but if the changes come too quick, it hurdles whatever is blocking for you, and goes to infinity.

The point at which I noticed this is when I was prototyping my own color editor. I wanted the color selection to be accomplished by an bitmap crossing hue and lightness, with another slider saturation. To make sure the sliders were in synch I needed to bind with a converter (to and from color). Now, I ran into computation problems, so I created a class that managed converting but only did so when needed, and bound everything to that. Problem is that when I bound outside my control, I hit an infinite recursion if the user moved over the color palettes really fast.

I traced it down to an interesting effect. The converter (when setup as two way), would trigger forward, then quickly back to reflect any conversion loss. But when chained with another converter that did the same, they bounced back and forth endlessly, like ping pong.

This only happened if the converters were triggered fast enough. So I’m guessing I overflowed some value that counted recursion stack.

Has anyone else noticed anything to this effect, and how can you avoid such problems when people use binding against the “result value property” of your control?

  • 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-05T08:15:17+00:00Added an answer on June 5, 2026 at 8:15 am

    If your converters are not accurate (e.g. have numeric calculations) then you will have to break the chain in a way similar to this…

    For notifying properties

    Instead of:

    public double MyProperty
    {
        get
        {
            return _myProperty;
        }
        set
        {
            if (value != _myProperty)
            {
                _myProperty = value;
                NotifyPropertyChanged("MyProperty");
            }
        }
    }
    

    Use:

    public double MyProperty
    {
        get
        {
            return _myProperty;
        }
        set
        {
            if (Abs(value - _myProperty) / (Max(Abs(value), Abs(_myProperty)) + double.Epsilon) > MyEpsilon)
            {
                _myProperty = value;
                NotifyPropertyChanged("MyProperty");
            }
        }
    }
    

    Or a similar inaccurate comparison, so that inaccuracies will not create an infinite loop.

    For dependency properties

    Use Register(String, Type, Type, PropertyMetadata, ValidateValueCallback) and PropertyMetadata(Object, PropertyChangedCallback, CoerceValueCallback) to define a CoerceValueCallback to prevent small changes (using the same algorithm as above).

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
In my XML file chapters tag has more chapter tag.i need to display chapters
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I am currently running into a problem where an element is coming back from
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am trying to understand how to use SyndicationItem to display feed which is
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but

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.