This is a migrated thread and some comments may be shown as answers.

Add/Remove Row

1 Answer 241 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Zbigniew Kozłowski
Top achievements
Rank 1
Zbigniew Kozłowski asked on 02 Jul 2010, 08:26 AM
Hi,
how can i remove selected row and how can i add new one to the top? Im writing simple email app, and i need to add new rows to the top when messages come, and remove selected row (because someone can delete it, or move to another folder). I know there is an event Deleted and Deleting, but that is not what i need.

1 Answer, 1 is accepted

Sort by
0
Stefan Dobrev
Telerik team
answered on 02 Jul 2010, 01:15 PM
Hello Zbigniew,

You should remove the items from your source collection and the grid will pick this changes and update its UI.

For example if you want to remove the selected item you can use the following code:
this.GridView.Items.Remove(this.GridView.SelectedItem);

If you want to add an item as a first row you should insert it in the collection that the grid is bound to:
((IList)this.OrdersControl.ItemsSource).Add(new MailMessage())
assuming that your object is MailMessage and the source collection is ObservableCollection.

Also you may want to look at our Step-By-Step tutorial for Silverlight illustrating this scenario as well as many others.

Sincerely yours,
Stefan Dobrev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Zbigniew Kozłowski
Top achievements
Rank 1
Answers by
Stefan Dobrev
Telerik team
Share this question
or