EmptyListToVisibilityConverter

前端 未结 6 1938
天涯浪人
天涯浪人 2021-01-19 03:21

I\'m trying to do an \"empty list to visibility converter\" for WPF. This is an IValueConverter that takes an object ( that should be a list ) and if the list is empty (or i

6条回答
  •  孤独总比滥情好
    2021-01-19 03:48

    My guess is that it's because of the fact that you're using IList in the converter but your actual collection is an IList. See, IList is not covariant so you can't just convert any IList to an IList. My suggestion will be to try and use IEnumerable in the converter instead and use the Count() extension method to determine the number of items in the collection.

    提交回复
    热议问题