Mani Kandan

Mani Kandan

  • NA
  • 2.6k
  • 129.1k

How can do sorting in ListView WPF C#.Net ?

Dec 13 2016 11:55 PM
Hello everyone,
 
I have Listview looking like this,  
  1. <ListView.View>  
  2.     <GridView>  
  3.         <GridView.ColumnHeaderContextMenu>  
  4.             <ContextMenu >  
  5.                 <MenuItem Header="Ascending" Click="MenuItem_Click" />  
  6.                 <MenuItem Header="Descending" />  
  7.             </ContextMenu>  
  8.         </GridView.ColumnHeaderContextMenu>  
  9.         <GridView.Columns >  
  10.             <GridViewColumn Width="155px" DisplayMemberBinding="{Binding FirstName}" Header="User Name" />  
  11.         </GridView.Columns>  
  12.     </GridView>  
  13. </ListView.View>  
  
What is the code for sorting listview inside MenuItem_Click 
  1. private void MenuItem_Click(object sender, RoutedEventArgs e)  
  2.        {  
  3.           //What is the code for here?  
  4.        }  
Here is image,
 
 
 
Regards,
Abhilash.J.A 
 

Answers (2)