WPF Binding FallbackValue set to Binding

前端 未结 3 1095
谎友^
谎友^ 2021-01-31 15:43

Is there a way to have another binding as a fallback value?

I\'m trying to do something like this:

3条回答
  •  伪装坚强ぢ
    2021-01-31 16:35

    What you are looking for is something called PriorityBinding (#6 on this list)

    (from the article)

    The point to PriorityBinding is to name multiple data bindings in order of most desirable to least desirable. This way if the first binding fails, is empty and/or default, another binding can take it's place.

    e.g.

    
        
            
                
                
            
        
    
    

提交回复
热议问题