locked
Fallback Color RRS feed

  • Question

  • Is there a way in Blend to specify the Binding Fallback Value to be a color?

    Lets say I want a TextBlock's foreground to be bound to some other control's border, but fall back to black if the binding fails.

    I have tried specifying different permutations of the hex (ex: ff000000, #ff000000, "#ff000000", etc)

    Sunday, March 27, 2011 6:08 PM

Answers

  • Yes.  Click the advanced options button next to the textBlock's Foreground and select Data Binding.  Add the binding you want (if it isn't already there).  Expand the Advanced properties section at the bottom and type the color name (i.e. Black, Green, Red, etc) in the "Binding default value" box and press OK.  Now if the binding fails that color will be assigned.

    Joel Cochran, MCTS (WinForms, WPF)
    Expression Blend MVP
    INETA Community Champion
    Blog: http://www.developingfor.net
    "Expression Blend in Action" now available from Manning: http://www.manning.com/cochran/
    Join BlendSIG: http://blendsig.groups.live.com
    • Marked as answer by jderus Friday, April 1, 2011 4:19 AM
    Monday, March 28, 2011 5:30 PM

All replies

  • Yes.  Click the advanced options button next to the textBlock's Foreground and select Data Binding.  Add the binding you want (if it isn't already there).  Expand the Advanced properties section at the bottom and type the color name (i.e. Black, Green, Red, etc) in the "Binding default value" box and press OK.  Now if the binding fails that color will be assigned.

    Joel Cochran, MCTS (WinForms, WPF)
    Expression Blend MVP
    INETA Community Champion
    Blog: http://www.developingfor.net
    "Expression Blend in Action" now available from Manning: http://www.manning.com/cochran/
    Join BlendSIG: http://blendsig.groups.live.com
    • Marked as answer by jderus Friday, April 1, 2011 4:19 AM
    Monday, March 28, 2011 5:30 PM
  • Thanks!

    It actually appears like some of my tests werent working because of some Binding setup issues. The info you provided about using DataBind->Element Property seems like a more useful workflow than the Element Property Binding dialog too.

    I appreciate your time.

     

    Friday, April 1, 2011 4:22 AM