1. 程式人生 > >繼續聊WPF——如何獲取ListView中選中的項

繼續聊WPF——如何獲取ListView中選中的項

  1. <Grid>  
  2.     <ListView x:Name="lv" SelectionChanged="lv_SelectionChanged">  
  3.         <ListView.View>  
  4.             <GridView AllowsColumnReorder="True">  
  5.                 <GridViewColumn DisplayMemberBinding="{Binding Path=Name}" Header="姓名"  
  6.                                 Width="65"/>  
  7.                 <GridViewColumn DisplayMemberBinding="{Binding Path=Age}" Header="年齡"  
  8.                                 Width="65"/>  
  9.                 <GridViewColumn DisplayMemberBinding="{Binding Path=City}" Header="所在城市"  
  10.                                 Width="70"/>  
  11.             </GridView>  
  12.         </ListView.View>  
  13.     </ListView>  
  14. </Grid>