I am attempting to override the appStylist theme setting for the Active UltraGridRow. Even if I False UseOSThemes, and False UseAppStyling I can not override the Active UltraGridRow Appearance. The purpouse is to provide a visual to the user that will indicate when an object is selected or not. This functionality works fine once the AfterSelectChange event is fired, i.e. activate a new row. I need to change the appearance of the active row itself. For instance if I click once on a row it should activate with the themed appearance. If I click on that row once more it should change the apperance of the active row.
Here's a simple example of one way I have tried.
Row.Appearance.BackGradientStyle = GradientStyle.GlassBottom37Bright;
Row.Appearance.BackColorAlpha = Alpha.Opaque;
Row.Appearance.ForeColor = Color.Black;
Figured out a pretty easy way of doing this, just had to find the appropriate namespace I guess. Any way here is a brief example of toggeling the active row appearance based on cell value.
First set the grid property UseOsThemes to False.
Second set the UseAppStyling Property to False.
Third Create the property below.
/// Sets the active row and selected row appearances based on the field "Boolean" value
{
set
Grid.ActiveRow.Band.Override.ActiveRowAppearance.BackColor = Color.White;
Grid.ActiveRow.Band.Override.ActiveRowAppearance.ForeColor = Color.Black;
Grid.ActiveRow.Appearance.BackColor2 = Color.WhiteSmoke;
}
Grid.ActiveRow.Band.Override.ActiveRowAppearance.BackColor = Color.Orange;
Grid.ActiveRow.Band.Override.ActiveRowAppearance.ForeColor = Color.WhiteSmoke;
Grid.ActiveRow.Appearance.BackColor = Color.Orange;
Grid.ActiveRow.Appearance.ForeColor = Color.WhiteSmoke;
Fourth: Not sure if you'll need this functionality, but I call this method via the mouse down event. Here is how I am accomplishing it, who knows it may or may not help you.
Point pt = new Point(e.X, e.Y);
//Single select only clear all other rows.
//set the appearance of the row
Im sure there is a much much easier way of achieving this, I attempted to use the grid formulas and value based cell appearance to accomplish this but I am still learning the ins and outs of the infragistics controls. If your grid supports multiple selection and you want to simulate the ctrl + click functionality with out the end user actually having to hold down the control key, just remove the for statment in the mouse down event.
Hope this helps someone :)
I need to override some of the appstylist settings for the active row of a grid. I have set the ResolutionOrder as ControlThenApplication but the ISL file happens to have some UI role settings for the Grid Row. How can I override these settings in my code?
I have set the ActiveRowAppearance on the Override of DisplayLayout for the Grid and also the above mentioned steps but it doesnt make any difference once I load such an ISL file.
I will not be able to change the GridRow settings in the ISL file because it seems to be used by UltraCombo also and I want these changes to be done only in the UltraGrid.
I have a similar problem. Have a styles *.isl file and I need to change the colors of the editable cells in a grid. But I cannot do it because of a styles that are defined in *.isl file. And I don't want to turn off these styles because it will destroy all application style.
How can I change properties of a grid if it has styles defined in *.isl file?
Thank you!
You will need to modify the isl file and remove those style settings that you don't want.
But I need these styles. I use cell's background colors throughout all my program in all of my grids. And there are some grids with editable cells, whose color has to be changed.
Mike, is there is only option in my situation - to delete the styles from the isl file?
Hi Yuri,
I don't understand. You said that you do NOT want the active row in the grid highlighted and now you are saying that you do need it to be highlighted. Which is it?
I'm not suggesting that you turn off all styling your entire application. I'm saying you go into the isl file using AppStylist and remove the Active state from the UltraGridRow Role.
If you have some grids you want to have highlight the active row and other that do not, then you could use Stylesets for this. What you would do is create a base styleset (or use the exiting one in the isl) and remove the settings you don't want. Then you create a new StyleSet and set it's BasedOn field to the original StyleSet and add in the active row highlighting. Then in your application, any grid you want to have active row highlighting on, you set the StyleSetName to the styleset that has the highlighting.
Another option is set to ActiveAppearancesEnabled on the grid to false.
You have infinite flexibility here, so I'm sure you can achieve what you want.
I think that it was a mistake to write here. I had to open a new topic.
I have no problems with an active row. I have a problems with overriding of settings in isl file.
And since we began to discuss it here, I think it makes sense to continue it here.
I have a grid. Grid has styles for grid rows and cells. You said that if I want to change some properties by myself I should turn them off in styles and then change manually. And also you said (in some other thread) that cell appearance is more important than row appearance.
I had reset cell properties. But it didn't help. I have the same problem - I cannot highlight editable cells.
if (cell.Column.CellClickAction == CellClickAction.Edit) { cell.Appearance.BackColor = Color.LightYellow; }
When appstyling is turned off - all works fine.
What can be wrong?
I have found the reason that prevented me from gaining my aim. I turned off row styles in AppStyler application. Than I assigned appropriate styles to cells. And as a result my cells have appearance and I can highlight them manually.
Thank you, Mike!