I want to override the default selection and active row appearance while doing drag and drop.
I tried this:
With Grid.DisplayLayout.Override .ActiveRowAppearance.BackColor = Color.PaleGoldenrod .SelectedRowAppearance.BackColor = Color.PaleGoldenrod End With
And then added this:
Grid.Rows.Refresh(RefreshRow.RefreshDisplay)
This is all before calling Grid.DoDragDrop(...)
Grid.DoDragDrop(...)
Tested the grid, and rows are being selected. I created a new grid and tested it, and you are right: it works.
The problem was that I had band level appearances set in InitializeLayout. These were overriding the grid level appearances that I was setting in the event handler.
Should have done a bit more research, sorry! Thanks for your help.
Hi,
Well... the code you have here will only affect the ActiveRow and the selected rows. Do you have any selected rows? You can check grid.Selected.Rows.Count to see.
The grid generally always has an ActiveRow, and I can't see any reason why that wouldn't work, unless maybe the ActiveRow is scrolled out of view so you just can't see it.
It's also possible that something else is overriding these properties. For example, if you are loading an isl (Application Style Library) file to style your application, those settings will take precedence over anything you set in code.
Sorry for the ambiguity, the code I mentioned above didn't work. Is there anything I might have missed to have it update? Or perhaps a better way than I'm trying to do it?
So what is your question?