Equiv. to Coalesce() in XAML Binding?

前端 未结 3 1296
深忆病人
深忆病人 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 01:53

    The PriorityBinding is only looking for DependencyProperty.UnsetValue to advance to the next Binding. Since Property1 exists it is set and the PriorityBinding is taking the value of it.

    For a pure XAML solution, this Style will do the job:

       
            
                
            
        
    

    Although, it's a bit convoluted way of doing it, and IMHO, doesn't belong in the UI but in the ViewModel.

提交回复
热议问题