Conditional element in xaml depending on the binding content

后端 未结 3 986
礼貌的吻别
礼貌的吻别 2020-12-29 07:09

Is it possible to display this TextBlock, only if the Address.Length > 0 ? I\'d like to do this directly into the xaml, I know I could put all my controls pr

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-29 07:41

    I would do this with another boolean property called HasAddress which returns Address.Length > 0.

    
    
    
    
    

    You should also remember to notify the property change for HasAddress in the setter of Address.

提交回复
热议问题