目前造成这个情况的原因还不清楚,我给你提供一个解决办法,直接添加数据。代码如下- Class MainWindow
- Dim personList As ObservableCollection(Of Person) = PersonData.GetPersonList
- Sub New()
- ' 此调用是设计器所必需的。
- InitializeComponent()
- ' 在 InitializeComponent() 调用之后添加任何初始化。
- C1FlexGrid1.ItemsSource = personList
- personList.Add(New Person With {.Name = "", .Age = 0, .Sex = False})
- 'C1FlexGrid1.Rows.Add(New Row)
- End Sub
- Private Sub C1FlexGrid1_CellEditEnded(sender As System.Object, e As C1.WPF.FlexGrid.CellEditEventArgs)
- If C1FlexGrid1.Rows.Count - 1 = e.Row Then
- 'C1FlexGrid1.Rows.Add(New Row) '增加一行
- personList.Add(New Person With {.Name = "", .Age = 0, .Sex = False})
- End If
- End Sub
- End Class
复制代码 |