How to get Items count from CollectionViewSource?

后端 未结 6 685
鱼传尺愫
鱼传尺愫 2021-01-17 09:19

I am using CollectionViewSource to filter the records displayed in a ListBox. The xaml follows.

   

        
6条回答
  •  一向
    一向 (楼主)
    2021-01-17 09:35

    I think the better solution is, as usual, Linq!

    _viewSource.View.Cast<[your_type]>().Count();
    

    ...or...

    _viewSource.View.Cast().Count();
    
    
    

    ...if you don't know the items' type at runtime!

    提交回复
    热议问题