I'm running into an issue with the following ultrawingrid property:ugParts.DisplayLayout.Override.CellClickAction = Infragistics.Win.UltraWinGrid.CellClickAction.RowSelect
I created an example project to demonstrate the issue. In the project there is an ultrawingrid and a standard button. The ultrawingrid initializelayout event is handled setting properties of the grid (including the CellClickAction) similar to the way we have our production application setup.
When you click the button it will activate the next row in the ultrawingrid. Clicking the button immediately after the form is loaded works as expected activating the next row. If you click on a row in the middle of the ultrawingrid and then click the button notice it activates a different row, but the row clicked on remains selected. I'm trying to get a single row selection behavior that will not allow individual cells to be selected when a user clicks on a row or the row activation is changed by the application. Is there something I'm doing wrong?
Download the Example UltraWinGrid Project Here
The previous row is not selected - it's active.You may want to also set the ActiveRow in the grid. Or, if you only care about a single row, then you probably want to turn off selection (set SelectTypeRow to None) and just deal with the ActiveRow.
If you do need to work with selected rows, then perhaps you should turn off the ActiveRowAppearace: FAQ:How do I turn off the ActiveRowAppearance so that the active row in the grid does not appear selected.
I did some further testing using the test application linked to above. The previous row IS selected. We do not want to change the selecttyperow to none as we want it to be single. Secondly our issue is not related to the appearance.
Here are the test steps I followed running the test application to figure out this appears to be a bug with selection/activation.
After step 3 the selected index should also be 1. The work around for this is when you click the select next button I have the activeRow.Selected property set to false.
ugParts.DisplayLayout.Override.SelectTypeCell = Infragistics.Win.UltraWinGrid.SelectType.None
ugParts.DisplayLayout.Override.CellClickAction = Infragistics.Win.UltraWinGrid.CellClickAction.RowSelect
Just to be clear... calling Activate on a row neither clears selection nor does it select anything. Activation and selection are completely separate and distinct.
It just so happens that under some circumstances (depending on the CellClickAction setting) clicking on a row will both activate and select the row. But there's no single method or property in code that would do both at once. :)
I'm sorry if I was not clear the first time. Thank you for your response. I thought the activate method should remove the last selection when you are using single row activation/selection. From your latest response I see that is not the case and we need to clear the selection.
Thanks Again!
Sorry, I guess I made a poor assumption there.
You code is not changing the selected rows at all. You are only setting the ActiveRow (by calling the Activate method). The Selected Rows collection does not change when you do this. If you also want to select the row, then you need to handle that in your code. You would probably want to do something like this:
this.ugParts.Selected.Rows.Clear();
this.ugParts.ActiveRow.Selected = true;
It sounds to me like you really don't want to be using selection at all, but rather you only want to use the ActiveRow. In which case, you should set SelectTypeRow to None.