I would like to understand if the following behavior of a XamDatagrid can be modified:
When I move with the cursor through one record from left to right and I selecting the last right cell and then move 1 cursor tip further I end up in the next record.
The desired behavior looks like this: I select the last cell in a record and try to move the cursor to the next right (not existing cell) the cursor stops. This is the same way the XamDatagrid works when you try to move from a top cell further to the top.
Hopefully I was able to explain the current and the desired behavior.
In order to make sure that we are addressing the right behavior, could you please provide us with more information. It would be very helpful if you can post an isolated sample with the action described, steps to reproduce it, or maybe even better - a short video.
Furthermore, I would like to ask you to confirm if the cursor you mentioned stands for mouse cursor, or you mean the current cell selection.
Looking forward to your reply.
Sincerely, Tihomir Tonev Associate Software Developer
actually every XamDatagrid example will do the job:
1. Select the cell most right in the first row = last cell
2. Press cursor key to the right
3. The first cell in the second row will be selected
I am looking forward for following behavior:
1. Select the cell most right in the first row
3. The last cell in the first row stays selected as before
1. Cursor is keyboard cursor in this scenario = cell selection
2. I tried to upload a simple app, but it did not show up here...
Thank you for the additional information.
If you would like to stay on the same record once the end of the row is reached, what I can suggest is hooking to a key press event and disabling it. The following snippet will help you achieve your requirement:
private void xamDataGrid1_PreviewKeyDown(object sender, KeyEventArgs e)
var columns = xamDataGrid1.ActiveRecord.FieldLayout.Fields.Count - 1;
var currentIndex = xamDataGrid1.ActiveCell.Field.Index;
if (currentIndex == columns)
if (e.Key == Key.Right || e.Key == Key.Tab)
e.Handled = true;
Should you have any further questions, please let me know.
Sincerely,Tihomir TonevAssociate Software Developer
thanks for the fast response - this does the trick!
I am testing it further because there are already some events in the area of KeyDown. In the case something unexpected shows up I would contact you again.