BoldSignEasily embed eSignatures in your .NET applications. Free sandbox with native SDK available.
grid.Model.Options.WrapCellBehavior = GridWrapCellBehavior.WrapRow;
- If you want to allow mutiple selected rows, then change the ListboxSelectionMode to something other than One or None.
this.gridControl1.RefreshCurrentCellBehavior = GridRefreshCurrentCellBehavior.RefreshRow
to get the whole row to repaint when you move teh currentcell. (If the old row does refresh, you could explicitly call grid.RefreshRange on the old row after your change your current member.)
If you are just using SelctionMode.One, then a simple int membmer can serve to hold your selected row and maintain it. If you want to support othe selection modes, mainting the selected rows becomes more problematic (but doable). One alternative might be to just use the grid's default selection with the alphblending set so low that you do not see the selections. Then in PrepareViewStyleInfo, you could check to see if e.RowIndex is a member of grid.Selections, and if it is, then color it.
Me.CustomGridControl1.Model.Options.WrapCellBehavior = GridWrapCellBehavior.NextControlInForm
Now if your grid is directly on a form, this is all you have to do. If your grid is on a panel, or groupbox or tabpage or some other container, then you will also have to handle the WrapCellNextControlInForm event and actually move the focus to where you want it in your container. Here is a sample that might help. The sample has 2 grids, the one on the left is parented to the form, and the one of the right is on a panel. Out of the box, just setting the NextControlInForm value, makes the grid on the left behave as expected, allowing you to tab from button1 to the grid to button2. But the grid on the panel does not behave as expected. There you tab from button3 to the grid to button 1, passing over button 4 which is the next button on the panel.
The way to handle this problem is to catch the WrapCellNextControlInForm event, and set the focus the way you want it done depending upon the parent container being used. In the sample, there is commented code in the handler that will move the focus on the panel (the way you might expect). The reason the grid architect opted to expose an event to handle this is that he did not want to try to add code to handle arbitary containers. Instead, the default behavior should handle a form as a parent, but if you have something else, then you will have to use the event.
2) In the AllowSelection property, there is a KeyBoard flag you can turn off. I am not sure this what you want though.
You can cancel any selection change by handling the grid.Model.SelectionChanging event. In it, you can test to see if the control key is pressed, cancel the action.
private void gridControl1_SelectionChanging(object sender, GridSelectionChangingEventArgs e) { if((Control.ModifierKeys & Keys.Control) != 0) { e.Cancel = true; return; } }
> Me.CustomGridControl1.Model.Options.WrapCellBehavior = GridWrapCellBehavior.NextControlInForm
>
>
> Now if your grid is directly on a form, this is all you have to do. If your grid is on a panel, or groupbox or tabpage or some other container, then you will also have to handle the WrapCellNextControlInForm event and actually move the focus to where you want it in your container. Here is a sample that might help. The sample has 2 grids, the one on the left is parented to the form, and the one of the right is on a panel. Out of the box, just setting the NextControlInForm value, makes the grid on the left behave as expected, allowing you to tab from button1 to the grid to button2. But the grid on the panel does not behave as expected. There you tab from button3 to the grid to button 1, passing over button 4 which is the next button on the panel.
>
> The way to handle this problem is to catch the WrapCellNextControlInForm event, and set the focus the way you want it done depending upon the parent container being used. In the sample, there is commented code in the handler that will move the focus on the panel (the way you might expect). The reason the grid architect opted to expose an event to handle this is that he did not want to try to add code to handle arbitary containers. Instead, the default behavior should handle a form as a parent, but if you have something else, then you will have to use the event.
>
> 2) In the AllowSelection property, there is a KeyBoard flag you can turn off. I am not sure this what you want though.
>
> You can cancel any selection change by handling the grid.Model.SelectionChanging event. In it, you can test to see if the control key is pressed, cancel the action.
>
> > private void gridControl1_SelectionChanging(object sender, GridSelectionChangingEventArgs e) > { > if((Control.ModifierKeys & Keys.Control) != 0) > { > e.Cancel = true; > return; > } > } >>