我用vs2008中的wpf application Browser模板创建了一个项目xmal文件中有一个listview,是System.windows.controls命名空间下的控件<ListView name="myListView">
<ListView.View> 
<GridView> 
<GridViewColumn DisplayMemberBinding="{Binding Path=FirstName}" Header="First Name" Width="100" /> 
<GridViewColumn DisplayMemberBinding="{Binding Path=LastName}" Header="Last Name" Width="100" /> 
</GridView> 
</ListView.View> 
</ListView> 数据绑定成功,页面可以显示
现在我想在listview中双击某一行,或者选中一行点击“修改”按钮,让这一行的单元格都变成可编辑状态,编辑完成后点击一个确定按钮更新到数据库,可现在连编辑都没实现
在cs文件中相应的响应事件里不知道该怎么写了,哪位大侠帮忙看看,先谢谢了
private DoubleClick(object sender,MouseButtonEventArgs e)
{
    //可以得到选中行
   int i = this.myListView.SelectedIndex;
   //接下来如何让选中行的单元格可编辑不知道怎么谢了
}

解决方案 »

  1.   

    又试了一下将listview中某一列设成TextBox,<ListView name="myListView"> 
      <ListView.View>  
        <GridView>  
          <GridViewColumn DisplayMemberBinding="{Binding Path=FirstName}" Header="First Name"   dth="100" />  
            <GridViewColumn Header="Last Name" Width="100" />  
               <GridViewColumn.CellTemplate>
                  <DataTemplate>
                       <TextBox Name="tbLastName" Text="{Binding Path=LastName}"  />             </DataTemplate>
               </GridViewColumn.CellTemplate>
        </GridView>  
      </ListView.View>  
    </ListView>想在xmal中先设置其失去焦点,双击一行后,再将其属性focusable设为true,但是在cs的事件响应方法中不知道如何能找到textbox,大家帮忙啊