문제

I have a code similar to next to load a data from a SQL query.....

Dim myDataset as new dataset = myMethod(params)  'This is a methos that fills a common dataset.

With Me.myRadDataGrid
      .AutoGenerateColumns = True
      .ItemsSource = myDataset.Tables(0).Rows
End With

So far so good....but when I tried to remove a line the object items do not nothing; the line do not show any exception, but nothing happend...

Me.myRadDataGrid.Items.RemoveAt(myIndex)  'Nohitng happend
Me.myRadDataGrid.Items.Remove(Me.myRadDataGrid.SelectItem) 'Nothig happend
Me.myRadDataGrid.Items.Refresh()
Me.myRadDataGrid.Rebind()

At the end the dataset collection into a RadGridView has the same elements....do not remove any row.

Thanks to all....

도움이 되었습니까?

해결책

You need to remove the item from the ItemsSource, not from the Items collection.

So remove the item from myDataset.Tables(0).Rows, and you'll probably need to refresh the grid manually since I'm fairly sure a DataTable will not automatically raise a change notification like an ObservableCollection does when an item gets removed.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top