I have a DataGrid with four rows and a few columns. Only the last column has an item (a button) with IsTabStop=True.
If I press tab the button in the first row gets the focus.
If I hit tab a second time the next control outside the grid gets the focus.
If I then hit shift-tab the button in the last row gets the focus.
Is there a way to make the DataGrid work like other controls and just tab normally through the four buttons?
For the focus to remain within the DataGrid, the current cell needs to be in edit mode.
http://msdn.microsoft.com/en-us/library/cc838112(v=vs.95).aspx
Related
I am using a devexpress grid control to display a grid. The grid shows a context menu. When i right click on a row, the menu is shown but only when the row is a newly added row. It means the menu is visible only on some rows so i have bound its visibility with a property on view model. The problem is if i right click on a row which doesn't show a context menu and then right click on the row which shows the context menu, the menu becomes visible on the last clicked row(the one which doesn't show context). Any help with this?
WinForms.
Let's say we have a grid on the form with some cell editors (checkboxes, radio button groups). The form has a file menu. File -> Save. User visits a few cells in the grid, and clicks a checkbox in a cell, and, without touching anything else with the mouse and without touching the Tab key, clicks on the File menu and then clicks Save.
Inside the Save menuitem click handler, is it possible to determine which checkbox in the grid had focus immediately prior? That checkbox won't have lostfocus yet because a menu choice doesn't cause its lostfocus event to fire.
I am using a PDA in which I have a DataGrid that has a list of itemNames, barcode, and scanStatus. The user scans a barcode and I search in my DataGrid for a match and I select the row for the item that is associated with the barcode. I set the scanStatus to true.
I was having a problem with the user touching the screen and the DataGrid's rows all got unselected.
So I tried to handle the DataGrid's Click, DoubleClick, and the MouseUp events. I loop through my grid where scanStatus is true and call grid.Select(iteratorIndex) else I call grid.UnSelect(iteratorIndex).
This re-selects the scanned item's rows. But the last cell that the user clicked also stays selected. How do I unselect that cell? I did search before posting and the only thing remotely matching my situation was this thread, I tried the advice there but it but that did not answer my question.
I want to be able to toggle selection when a row is clicked. So, first click should highlight it and second click (again on the row) should unhighlight it (and fire an event). Is it even possible? I'm using a OnSelectionChanged event but that gets fired only when I click on a different row than the selected one.
there a some useful answers here(searching the visual tree) or here(check in PreviewMouseLeftButtonDown).
Is it possible to turn off the selected row highlighting when a user clicks another control in the window?
Thanks in advance.
You could set the SelectedIndex to -1 in the LostFocus event, thus losing the selected item and removing the highlight.