User (Old forums)MemberFebruary 22, 2007 at 9:23 amPost count: 23064
Can anyone please help me , how to delete rows in datagrid?
I have Invoked KeyDown event of Datagrid Control.
protected void DataGridControl_KeyDown(object sender, RoutedEventArgs re)
if ((re as System.Windows.Input.KeyEventArgs).Key == Key.Delete)
But Unfortunately it is not working. Am I doing anything wrong?
Thanks in Advance,
Imported from legacy forums. Posted by debkumar (had 8502 views)Xceed SupportMemberFebruary 22, 2007 at 9:40 amPost count: 5658
Deletion is currently not handled by the DataGridControl, you can refer to <a href=”http://forums.xceed.com/forums/ShowPost.aspx?PostID=5799″>this post</a> about this topic.
Concerning your sample code, DataGridControl.SelectedItems represents user selection in the DataGridControl and removing items from this collection will simply change the current user selection.
What you wish to do is the call the “remove” method on your data source (what was assigned to the ItemsSource property).
Let me know if you have problems with that.
Imported from legacy forums. Posted by Marcus [Xceed] (had 443 views)User (Old forums)MemberFebruary 23, 2007 at 9:20 amPost count: 23064
Thanks a Lot.
Imported from legacy forums. Posted by debkumar (had 389 views)User (Old forums)MemberMarch 6, 2007 at 11:25 amPost count: 23064
Please consier row delete functionality to be a high priority.
Imported from legacy forums. Posted by Darrel (had 416 views)Xceed SupportMemberMarch 6, 2007 at 12:58 pmPost count: 5658
Can you provide specific deletion requirements which would not be addressed by this post or the post referred (just so we can update the feature requirements).
Imported from legacy forums. Posted by Marcus [Xceed] (had 446 views)User (Old forums)MemberMarch 6, 2007 at 1:10 pmPost count: 23064
I would like to see the Delete functionality to be included in the grid:
1. Select one or more rows, press the delete key and the rows get deleted.
2. Configuration controls to enable/disable updating and deleting of rows (i.e. AllowUpdate, AllowDelete).
I would consider the previous posts to be a workaround to something that is expected in a grid control.
Overall, I’m very happy with the grid.
That said, here is some code to handle delete when the grid is unbound and the underlying data is based on the Items collection (i.e. ItemsSource is null):
void dataGridControl_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)
HandleDeleteRows(sender as Xceed.Wpf.DataGrid.DataGridControl);
/// Handle Delete Rows
private void HandleDeleteRows(Xceed.Wpf.DataGrid.DataGridControl dataGridControl)
if (dataGridControl.SelectedItems.Count > 0)
ItemCollection itemCollection = dataGridControl.Items as ItemCollection;
if (itemCollection != null)
foreach (String items in dataGridControl.SelectedItems)
Imported from legacy forums. Posted by Darrel (had 704 views)Xceed SupportMemberMarch 6, 2007 at 1:14 pmPost count: 5658
Thanks for the feedback!
Imported from legacy forums. Posted by Marcus [Xceed] (had 369 views)User (Old forums)MemberMarch 21, 2007 at 11:07 amPost count: 23064
I would completely agree with the other posters that this is a very high priority. In my view, the grid is incomplete without the delete functionality. I just wasted 30 minutes trying to find the delete functionality in the docs and samples, only to finally find out there is no way by reading this forum.
Imported from legacy forums. Posted by William (had 577 views)User (Old forums)MemberJune 24, 2007 at 8:55 pmPost count: 23064
I wish to add my vote to having row deletion built it, especially if this is to be used as an alternative to the Windows Forms DataGridView which does have it built in.
Imported from legacy forums. Posted by Alan (had 492 views)User (Old forums)MemberJuly 26, 2007 at 11:21 amPost count: 23064
Has the delete functionality when ItemSource is not null been released?
Imported from legacy forums. Posted by Adam (had 423 views)
- You must be logged in to reply to this topic.