I am using a ultraTree with Outlook ViewStyle and want to display columns having different back colors.
I have tried to apply header apperance back color in ColumnSetGenerated event but it didn't work.
newColumn.HeaderAppearance.BackColor = Color.Red;
Please, can you tell me, whats going wrong?
HeaderAppearance only affects the column header. Are you saying that the HeaderAppearance is not changing the color of the column header? Or that you are trying to change the appearance of the cells and not the header?
Thanks Mike for your quick reply.
Yes.. HeaderAppearance is not changing the color of the column header.
The most common reason for that is that the headers are using operating system themes.There's a KB article about this here:
HOWTO:Change the Color of Column Headers in the WinGrid
The article is talking about the grid, but it's the same issue in the tree. Try setting ThemedElementAlpha to Transparent on the same appearance on which you are setting the BackColor. Or turn off themes for the whole try by setting UseOsThemes to false.
I tried setting ThemedElementAlpha to Transparent , but no luck still HeaderAppearance is not changing the color of the column header.
This is what i am trying to do.
ultraTree.UseOsThemes = DefaultableBoolean.False;
foreach (var column in ultraTree.ColumnSettings.ColumnSets.Columns)
column.HeaderAppearance.BackColor = Color.Red;
Are you loading a Style Library (.isl file) into your application?
If the isl file applies a background image to the column headers, then that image would cover the background and you would not be able to see the color.
Yes we are loading Style libraray. Is there any way to override and apply backcolor to the column. or What is the best way to apply backcolor without changing any thing in .isl file.
As a general rule, the appearance settings on an individual object (such as the header of a column) override the appearance on the application level provided by an isl.
But my guess is that in this case the isl file is applying an ImageBackground to the column headers and therefore the image covers up the BackColor. There's nothing you can do about that without either:
1) Remove the image from the isl.
2) Use a DrawFilter to stop the UIElement from drawing the image on this particular element.