Equiv. to Coalesce() in XAML Binding?

前端 未结 3 1298
深忆病人
深忆病人 2021-01-03 01:24

In SQL I can do this:

Select Coalesce(Property1, Property2, Property3, \'All Null\') as Value
From MyTable 

If Property1, 2 and 3 are all n

3条回答
  •  北荒
    北荒 (楼主)
    2021-01-03 02:07

    Since you are binding to a String, null is a valid value for the PriorityBinding. I'm not sure what your Item class's property types are, but if you use Object, and set them to DependencyProperty.UnsetValue, you will get the behavior you are looking for.

    The PriorityBinding documentation's remarks section describes how it works in more detail.

提交回复
热议问题