I have implemented a DrawFilter which causes my cells with errors to have their backcolor drawn as red. The cells which have errors should have red backgrounds with black text. However, it seems that the Active Row color is "laying over" the actual cell and is semi-transparent, causing my cells actual color to be reddish orange, and the text to be a grey orange. How can I stop the ActiveRow's selection color from being drawn on top of my cell? And even on the non-error cells, I want my text to be black, not grey orange.Here is my DrawElement implementation (executing upon the CellUIElements DrawPhase.BeforeDrawBackColor):
AppearanceData appearanceData = new AppearanceData() { BackColor = Color.Red }; drawParams.DrawBackColor(ref appearanceData, drawParams.Element.Rect, drawParams.InvalidRect, true); return true;
To be clear, I don't want the active row appearance to be displayed at all within cells which have errors. I am on vs. 7.2 and don't have access to the ActiveAppearance and ActiveAppearancesEnabled properties.
Your grid must be using the SelectionOverlay feature. This works like Excel where the selected rows are drawn using a semi-transparent color which is drawn on top of the row.
If you want a cell to be a specific color and not show the overlay, then you will have to turn this functionality off for the entire grid. There's no way to draw the overlay over some cells and not others.
Look for SelectionOverlay in your code, or if you are loading an isl, then you will need to turn this off in the isl using the grid's component role.
Thanks for your reply Mike. We are using a combination of .isl and setting properties off of the Grid's DisplayLayout. I'm not finding any of the SelectionOverlay properties on this.DisplayLayout or this.DisplayLayout.Override.I've seen others accessing SelectionOverlay* off of thisGrid.GridSettings, but I have been unable to find GridSettings off of my grid object either.This leads me to the .isl files. I have opened the .isl's in np++ and searched for selection overlay, but did not find any results. I also opened it in AppStylist, but wasn't able to find it referenced there either (on the cell or row roles, or grid component role (looking in the "UltraGrid-specific Properties" box)). It is of note that in the AppStylist, the active row doesn't seem to have SelectionOverlay enabled as the preview of the grid shows the active row as the desired orange/yellow, and the text still remaining completely black across the whole row (what I want). So maybe the problem isn't here.Admittedly, I'm a novice with these controls, so your help is appreciated =).
Hm. SelectionOverlay wasn't added until v9.2. So if you re using v7.2 that can't be it. But there isn't any other transparent overlay drawing in the grid that I know of.
So that means you are either drawing this yourself using the DrawFilter, or else you are using an Appearance somewhere that is setting the AlphaLevel so that some part of the grid are semi-transparent. Perhaps you made the cells transparent or partially transparent and what you are seeing here is the cell color combining with the row color behind it.
Hey Mike,
I'm still struggling in resolving this issue. A couple of questions:
1) What property is it (on the row) that determines the selected appearance of the row? UltraGridRow has Selected, and RowSelectorAppearance, but no SelectedAppearance, which is what I was logically looking to find.
2) Does the row's selected appearance override the appearance of individual cells (even draw filters applied to those cells?)? i.e. if row.SelectedAppearance.BackColor was Blue, and Cell.BackColor was red, which should show? Blue or red? If it does, how can I turn this off?Directly after calling drawParams.DrawBackColor within my DrawElement portion of my DrawFilter, I am then calling cell.ResolveAppearance and the appearance is not resolving to the appearanceData that I had just passed in to DrawBackColor (it's resolving to the appearance for the selected row).3) I believe that the cell appearance i am setting is being overriden by the GridRow appearance that is being defined in my .isl file as follows: <style role="GridRow"> <states> <state name="Active" backColor="255, 190, 116" foreColor="Black" backGradientStyle="None" backHatchStyle="None"> <resources> <name>GridRow_Active</name> </resources> </state> If this is the case, how can I make this setting be ignored for my cell?
Hello Jeff,
1) You have this appearance in the Override - Override.SelectedRowAppearance;
2) If the object is selected then it will be shown with the selected appearance. You could turn off the Override.SelectedAppearancesEnabled;
3) You could make the Grid to take take over the appearances in the isl file. Please take a look at the ResolutionOrder property of the UltraGrid component role in the AppStylist.
Thank you for your replies. Unfortunately, I do not have access to SelectedAppearancesEnabled, and I didn't see any change in functionality when modifying the SelectedRowAppearance (perhaps due to the difference between active and selected). I did see some interesting effects by changing the ResolutionOrder, but none were particuarly desirable.In the end, I removed the offending information from my isl file, and decided to maintain the colors of the rows and their cells manually. It's a bit of a pain, as I have to handle everything through events such as BeforeRowDeactivate and OnActiveRowChange, but at least it's working!The last barrier I'm finding that I need to overcome is that I would like to retrieve an image resource from my ISL file programatically. I am aware of how to retrieve the appearance of a given UIRole from an isl file, but the resources don't seem to be attached to any role in particular. Any suggestions?
Did you find time to try the suggestion with resources. Please let me know if you need any addition assistance!