How to data bind multiple values to a single TextBlock.Text in WP7?

前端 未结 2 1965
臣服心动
臣服心动 2021-01-17 23:43

How can I bind 2 properties to a single TextBlock.Text (eg. first name and last name or current value and max value)?

something like:

// IValueConver         


        
相关标签:
2条回答
  • 2021-01-18 00:02

    If you are working with WP7.1 (I know you mentioned WP7), take a look at the Cimbalino Windows Phone Toolkit. It offers a MultiBindingBehavior.

    0 讨论(0)
  • 2021-01-18 00:10

    Silverlight 3 (on which the Windows Phone 7 framework is built) doesn't support MultiBinding, which is what you would use to achieve what you need. However, there is a workaround solution that you can use described in the post MultiBinding for Sivlerlight 3, which should also work on WP7.

    Alternatively, you could extend your view model (or at least the properties that you are exposing) to expose a property that aggregates your values and raises property change notification when either changes.

    0 讨论(0)
提交回复
热议问题