I have read some posts about disable app styling for a certain grid but could not resolve it to my problem. I can not see any logic there.
I use a predefined .ISL style library in my app (office black.isl. I have disabled the active row and selected row appearance by this code:
e.Layout.Override.ActiveAppearancesEnabled = DefaultableBoolean.False; e.Layout.Override.SelectedRowAppearance.Reset(); e.Layout.Override.ActiveCellAppearance.Reset();
But selecting a cell the cell backcolor is still set to some orange color and backcolor of cells are not visible. All what I want is a black color (thickness 2) around the active cell. Selected cells should have also a black color of thickness 1. Default border color is light grey.
I tried this but does not work (see image attached):
// Active cell band1.Override.ActiveCellAppearance.Reset(); band1.Override.ActiveCellAppearance.BackColor = Color.Transparent; band1.Override.ActiveCellAppearance.BorderColor = Color.Black; band1.Override.ActiveCellBorderThickness = 2; // Selected cells band1.Override.SelectedCellAppearance.Reset(); band1.Override.SelectedCellAppearance.BackColor = Color.Transparent; band1.Override.SelectedCellAppearance.BorderColor = Color.Black;
Can someone give me some advises to achieve this?
Regards
Markus
Hi Markus,
What version of the controls are you using?
And which Isl file are you using? There is no "office black.isl", so I assume you meant 'Office2007Black.isl'? Or is this your own custom isl file? Have you made changes to the isl?
The isl file setting override the settings you apply in code. It looks like this isl file has both active and selected appearances applied to the grid row.
So there are only two ways to turn this off:
1) Remove these settings from the isl file itself. This means turning it off for all grids.
2) Turn off both active and selected appearances in the grid. You are only turning off ActiveAppearancesEnabled, but you did not turn off SelectedAppearancesEnabled. So that's why you are still seeing the orange.
If you go with option 2 here, then you cannot have a border around the active or selected row. It's all or nothing.
Also, there's no way to apply a border around the active row - the grid only has this functionality for selected rows.
So... if you want to have a border around the selected row, it seems to me that you will need to do this in the Isl file. If you want this for all grids in your application, then it's fairly simply. If you want to do this on some grids and not others, then you will need to create multiple StyleSets in your isl and apply them to the grids you want using the StyleSetName property on the grid(s) in your application.
Hello Mike,
thank you for your reply. I use the Office2007Black.isl file. I have attached the file I'm using at the moment. I think it is unchanged, just renamed.
I have tried approach 2 and the 'orange' disappears.
Can you tell me now, where I can find the 'orange' color in the .isl file? I could not find it. And can you give some advises which properties I have to set for:
- black border, thickness 2 around active cell
- black border, thickness 1 around each selected cell
- selecting block of cells (holding down left mous button) also over disabled rows.
I don't need borders around the active row or selected row as you wrote in your reply.
I also tried the SelectionOverlay-Properties but I have read that borders can not be applied if cells are not togehther. This can happens if child rows are visible. Users should be able to select block of cells in band 1 (see picture last post), but child rows in band 2 can be visible in some situations.
The target I'm trying to achieve here is to visualize active cell and blocs of selected cells where cell back colors are still visible.
........forgot in last post:.......the version: I'm using 2011.2, but the .isl file is from a earlier version, probably 2011.1 or 2010.3.
Are you sure the .isl file overwrites the code settings, not opposite way?
Hi Mike,
I have found that the resolution order of the settings can be changed. Setting this to 'ControlThenApplication' brought me little bit closer to the appearance I need (see picture). BackColor and ForeColor must be still visible.
I have also found how active and selected rows appearance are defined in the .isl file. I didi not realized so far that resources are added.
My final problem is to deactivate the active and selected row appearance from this grid, but keep it for others. I tried to remove the resources at runtime but this removes it from all grid. I tried to define additional style set in the ISL file, but different styles can not be applied to the same control (?).
How can I disable the resources just for one grid?
At the moment I have disabled ActiveAppearances and SelectedAppearances and have enabled SelectionOverlay. That looks like the picture attached. However, BorderThickness is applied to the active cell, but BorderColor not.
If I can not remove resources for one grid, do you have a solution to get other border color for the active cell than the default border color?
Thanks for any help.
I have applied the style sets and it works perfectly.
Thank you Mike.
Hi,
StyleSet support inheritance. So what you would do is create a base StyleSet - or your the Default StyleSet that already exists in your isl. This StyleSet would have no Selected or Active row appearance applied.
Then you create a new StyleSet and set it's BasedOn to the default. In this StyleSet you add in the selected and/or active grid row appearances you want on some of your grid.
Then, in your application, you set the StyleSet name of the grid that need to show selected/active rows to the name of the derived StyleSet you created.