DataGriDataGrid 中TextBox列中怎么获取 输入 的 内容???d 中TextBox列中怎么获取 单元格中 输入  编辑 的 内容???

解决方案 »

  1.   


    1.  string a = e.Item.Cells[控件所在索引].Text;  2.  string a= ((TextBox)(e.Item.Cells[控件所在索引].Controls[0])).Text;have a try!
      

  2.   

    应该加在DataGrid的哪个事件里啊
      

  3.   

    没有cellclike这个事件啊 而且为什么Item提示不包含定义呢?
      

  4.   

    是DataGridTemplateColumn里插入的textbox列 请问大侠们应该怎么 获取这一列 被编辑的 值 ???来人呀~
      

  5.   

    string str = (e.EditingElement as TextBox).Text;
      

  6.   

    这个不行啊 只能获取 TextColumn列的
      

  7.   

     private void dgView_CellClick(object sender, DataGridViewCellEventArgs e)
            {
                if (e.RowIndex == -1 || e.ColumnIndex == -1)
                {
                    return;
                }
                if (dgView.Rows[e.RowIndex].Cells[e.ColumnIndex].Value != null)
                {
                    MessageBox.Show(dgView.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString());
                }
    }
      

  8.   

    我的。.xaml文件内容是这样的 <DataGridTemplateColumn  Header="VALUE" Width="*" >
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <TextBox IsReadOnly="{Binding Type,Converter={StaticResource Type2Bool}}" Text="{Binding Value}" BorderThickness="0"/>
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
    在DataGrid中的<TextBox列绑定的是Value现在想 获取此列中编辑的值 怎么在.cs中写?加什么事件 内容是什么 请各位大神指教了~~~