Hi,
I was trying to clear the selected rows of an ultragrid from an external sub (inside the same from).
I already read the forum (mainly http://www.infragistics.com/community/forums/t/26429.aspx) and i tried with several different attempts, but nothing is working.
Here you are what I tried with no effects (alternative attempts):
GridReports.DisplayLayout.Override.SelectTypeRow = SelectType.None
GridReports.ActiveRow.Selected = False
GridReports.ActiveRow = Nothing GridReports.DisplayLayout.Override.ActiveRowAppearance.Reset()
GridReports.SyncWithCurrencyManager = False GridReports.DisplayLayout.Override.RowSelectors = DefaultableBoolean.False
GridReports.DisplayLayout.Override.ActiveAppearancesEnabled = Infragistics.Win.DefaultableBoolean.False
GridReports.Refresh() 'In order to refresh the grid
What is missing?
Many thanks
Alberto
Hi Alberto,
Thank you for posting in our forums!
Let’s clarify you scenario. By clearing the selected rows you mean, resetting their appearance and state of selected to unselected and by using external sub in the same form, you mean clicking on a button for which explicitly forces this action.
The first approach I came with is subscribing to a button click event and type the following code inside it.
In this case I take advantage of using a lambda function, in order to filter all rows that have been selected and then I just unselect every one of them.
Please let me know if you that works for you.
unfortunately it does not work: it flows thru' the selected cell, but after the row remain selected (highlighted in blue)
Do I have to refresh somehow the grid? (or where is the trick?)
In fact you don’t have to refresh explicitly the grid and there is not magic trick for this action. It seems that somewhere in your code, when a row is selected a new appearance object is initialized with back color similar to the highlighted color. In this scenario you can either find and remove this code or in addition to the provided code explicitly reset the appearance of all selected rows.
I am waiting for your feedback.
I see your point. After the code you suggested, if i run a test (looping across all rows) no rows seems to be selected
However as you can see in the following Screenshot, the grids seems to be still with selected rows (I how you can see my copy & paste attachment
The question should be: how can I display tables without any on these blu rows?
Thanks
Although I am not able to see your screenshot, I see what you are trying to accomplish.
In case your application uses an AppStylist library, you want to prevent the grid of applying these appearances. Second, you want to make sure that the default selected back color is reset and optionally you can even reset all appearances and apply your own after that. This all should happen ideally on the bottom of the main form’s load event.
Let me know if you have any additional questions.