Binding visibility of a control to 'Count' of an IEnumerable

前端 未结 3 1755
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-19 08:55

I have a list of objects contained in an IEnumerable<>. I would like to set the visibility of a control based on the count of this list. I have tried:

 Visibi         


        
3条回答
  •  猫巷女王i
    2021-02-19 09:58

    You cannot use logical or code-expressions in bindings (it expects a PropertyPath). Either use a converter or triggers, which is what i would do:

                         
        
    
    

    (You can of course refactor the style into a resource if you wish.)

提交回复
热议问题