Binding using logical expressions in SL4 RRS feed

  • Question

  • Is it possible to use logical or math expressions in the binding of properties? Something as simple as "If x then 'this' else 'that'."

    What does such a expression look like? Any examples of this?

    Friday, April 23, 2010 1:34 PM

All replies

  • You probably will want to use a value converter.  This will allow such logic to be written in c# or vb code.  See this blog post for a good intro:



    Friday, April 23, 2010 2:53 PM
  • Can you give a specific example of using a value comverter in order to provide a logical expression in a SL$ property binding?

    This seem s more awkward and complicated than it should be.

    Monday, May 17, 2010 2:11 AM
  • Could you tell me what you are trying to accomplish?  Generally the View (the V in MVVM) should have very little of this type of logic, and it instead should be handled in the View Model code.  The view should just be bound to a specific property/instance.


    I can certainly post an example, but narrowing down what you are trying to accomplish should help make it more relevant to you.

    Monday, May 17, 2010 1:01 PM