How can I sort a ListBox using only XAML and no code-behind?

后端 未结 1 1434
囚心锁ツ
囚心锁ツ 2020-12-01 02:34

I need to sort the strings in a ListBox, but it is bound to the view model by another component via the DataContext. So I can\'t directly instantia

1条回答
  •  天涯浪人
    2020-12-01 03:19

    Use a CollectionViewSource:

    
        
            
        
    
    
    
    

    You might want to wrap your strings in a custom VM class so you can more easily apply sorting behavior.

    0 讨论(0)
提交回复
热议问题