I have a XamGrid, with a filtersettings set to display the filter row.
We have functionality in the grid mouse events to detect the delete key and to delete any selected rows. The problem is, if they are trying to remove the filter cell value by hitting the delete key while using the filter row, our logic is still being fired.
How would I tell whether they are in a regular grid row, or the filter row when the "DEL" key is pressed?
With DeleteKeyAction = SelectedRows. It actually deltes the row directly. Its not showing the confirmation message box.
And When I am handling this MessageBox in with the help of input binding:-
<
>
=xamGrid1}">
public void DeleteRecords(XamGrid grid) { MessageBoxResult result = MessageBox.Show("Do you really want to delete this record?", "Delete confirmation", MessageBoxButton.YesNo); if (result == MessageBoxResult.Yes) { foreach (Row selectedRow in grid.SelectionSettings.SelectedRows) { grid.Rows.Remove(selectedRow); }
} }
But its just deleting the first selcted row. Again I need to click delete key.. Its showing this message for very selected row. Is there any other way solve this issue.
Hi,
Basically the DeleteKeyAction, allows for you to specify what to Delete when the Delete key is pressed:Such as : SelectedRows, SelectedCells, ActiveCell, etc..
It also fires the RowDeleting and RowDeleted event, so that you can react to a deletion.
-SteveZ
Here is the use case we have. The user can select 1 or multiple rows in the grid. They can either right click and select delete from a context menu or just hit the delete key, we prompt are you sure? If they do we load up an ARG object with a list of primary keys of each row, and then we call a WCF service that deletes the data and returns refreshed data.
Would the DeleteKeyAction property have made this easier?
I am curious why you are trapping the DEL key yourself? xamgrid already supports deleting rows using by listening for the DEL key press, and we expose RowDeleting and RowDeleted events if you want to plug into the delete pipeline.
Is there a scenario that we aren't supporting for you?
Devin
You might also want to check out the DeleteKeyAction property off the grid.
http://help.infragistics.com/NetAdvantage/Silverlight/2010.2/CLR4.0/?page=InfragisticsSL4.Controls.Grids.XamGrid.v10.2~Infragistics.Controls.Grids.DeleteKeyAction.html