Does AppStylist prevent DrawElement from firing? I have a grid using AppStylist and I want borders between column goups. The GetPhasesToFilter is firing which includes
if (drawParams.Elelemnt is CellUIElement)
return Infragistics.Win.DrawPhase.AfterDrawBorders;
However, DrawElement is not firing. How do I get DrawELement to fire. Thanks.
Ron
Hi Ron,
If you are returning the AfterDrawBorders phase from GetPhasesToFilter, then the DrawElement should fire for that phase.
The only reason I can think of why it would not work is if the element in question is in a state where it is not drawing any borders. I doubt it's specific to AppStylist, and it seems pretty odd for a CellUIElement, but I suppose it's possible that there is some combination of circumstances under which the cell draws no borders.
Are the cells in the grid drawing any borders without the DrawFilter? If not, then they might be deliberately skipping that phase because borders are simply not supported for those elements under the current conditions.
I'm using a modified version of Windows7.isl for the AppStyle, but as far as I know the only change is to remove the row hot tracking. But if I remove the AppStyle library reference,
the DrawElement event does fire, so I guess it's in the style somehwere. I'll keep looking and probably will have more questions. Thanks.
Just checking to see if my returned sample executes.
Thanks,
Sorry for the delay. I never got a notification that you posted your sample.
Anyway, I ran it now, and it looks like I was correct. Your isl is explicitly turning off the borders for these objects and making them transparent, so the DrawFilter is skipping this phase. This is a little odd, but I think it does this in cases where the particular phase doesn't draw at all. As far as the grid is concerned, the headers and cells have no border and so no space is being left for the borders or being accounted for when positioning other objects. For example, when the header draws it's text, it's normally inside the borders, so if there are no borders and then you draw some, your borders will end up too close to the text because no padding was created.
If you want to handle the border drawing in your drawfilter, then you can't turn off the borders completely in the isl file.
In fact, your isl is actually turning off the borders on everything by setting the Border color to Transparent on the 'Base' role. This is not a good idea. It's generally bad practice to set any properties on the Base role, because this can have unintended consequences (such as the one you are currently experiencing) since it affects every object at every level. The only exception to this is the Themed Element Alpha, which is useful for turning off themes aplication-wide.
I still can't get it to display the borders in my sample. In the AppStylist for the .isl file, I changed the UI Role>Base -- Properties>Border Style to Solid, Common States>Border to Black, Other States>Edit & Read Only Border to Black; same for Grid Cell and Grid Row. Still no borders anywhere. What do I need to change? Thanks. Ron
Sorry, it looks like your isl is turning off the borders in several different ways.
The 'Base' role is setting the border color of everything to transparent.
The Base-->Header-->GridHeader role is setting 'Border Style' to None (on the Properties tab)
And finally, the Base-->ControlArea-->GridControlAreaBase-->GridControlArea role is setting the Border Alpha to Transparent.
So you have to correct all three of these in order to get borders to show up.
Okay, that sort of works, but the border alignment is off vertically, and the last grid column's border is thinner. At least I'm getting some of the borders. I think it's going to take a while to get it right. This seems like a lot of tweeking for column separators, but thanks as always for your help.