 悬赏园豆:100
                [已关闭问题] 
            
                    关闭于 2013-09-29 19:03
                悬赏园豆:100
                [已关闭问题] 
            
                    关闭于 2013-09-29 19:03
                 
        用的是mvvm,在窗体中,怎么通过点击一个修改按钮,实现datagrid的行处于编辑状态或者是把第一个单元格处于编辑状态.
datagrid 有这个属性 SelectedItem="{Binding SelectedAttendanceFormula}"
再 定义 textbox text="{Binding SelectedAttendanceFormula.Name}"
我都是 这样 做的
在 viewmodel 定义get set 属性
private 你的对象类型 _SelectedAttendanceFormula;
        public 你的对象类型 SelectedAttendanceFormula
        {
            get { return _SelectedAttendanceFormula; }
            set { _SelectedAttendanceFormula = value; OnPropertyChanged("SelectedAttendanceFormula"); }
        }
你这是绑定的吧? 我需要的怎么让行处于编辑状态?
解决方案
System.Windows.Controls.DataGrid dataGrid = (System.Windows.Controls.DataGrid) obj;
 System.Windows.Controls.DataGridCell cell= dataGrid.GetCell(index, 1);
 cell.IsEditing = true;