I use three colors(Red, Amber and Green) for rows in my treelist control based on the datatable soucre data.
Let suppose I have five columns in my datasource, like IsRed, IsAmber, IsGreen, Title and Date. I color code rows in treelist using the data present in datasoure columns (IsRed, IsAmber, IsGreen) by using the TreeList.NodeCellStyle event as follows.
if (Convert.ToString(e.Node["IsGreen"]) == "True")
e.Appearance.BackColor = Color.LightGreen;
else if (Convert.ToString(e.Node["IsAmber"]) == "True")
e.Appearance.BackColor = Color.Orange;
} While loading the treelist for the first time, I am able to populate treelist correctly with color using these conditions. I also use CheckEditItem in my treelist control.
Now my problem is, when I select/unselect the CheckEditItem , I need to change the background color to Green whenever I select it and retain its original color when un select it. Can you please suggest a better way to accomplish this.
Is your intention to post an answer to your own question?
- If so, then proceed.
- If you simply wanted to post additional information, ask for further clarification, or to just say "Thanks!", please click Leave a Comment.
- If you wish to edit your original question, please use the Edit button in the Toolbox at the top right corner of that entry.