Rank: Newbie Groups: Member
Joined: 11/2/2011 Posts: 4
|
Hi,
Apologies if this has already been covered - I did search but I couldn't find anything useful.
I have a tree view and I'd like to use CSS to style it. I'm confused by the documentation around CSSFile, CSSBlock and CSSClass!!
Could someone help me with an example of how I do this please? Also is there a list of the CSS classes can use to style the tree view? I'm thinking of something like that on the AJAX Control Toolkit site (http://www.asp.net/ajax).
Specifically I'm looking to ensure the cursor is a hand and the text is underlined when hovering over a tree node. I'd also like to be able to set the image/icon for the tree node and alter the way the tree itself is drawn.
Thanks in advance,
Paul
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
If you are new to our controls, you can ignore CssFile and CssBlock. All you need to pay attention is the various ElementStyle property. For example, TreeView.TextBoxStyle can be used to customize the style of the text box used to edit a tree node item.
There are a lot of such style properties. For example, you can have different styles for each tree node when the node is different (hover, selected, etc). You can have different styles for different levels of nodes, etc. Each of these ElementStyle object has a number of child properties. For starters, you can ignore all other properties except for CssText and CssClass. For example, if you want the textbox to have a blue background, you would use something like this:
TreeView1.TextBoxStyle.CssText = "background-color:blue;"
Or
TreeView1.TextBoxStyle.CssClass = "your_css_class_with_blue_background"
These are standard properties. So you can set it either in code or in your ASPX.
To get a full picture of what styles properties are available and how they are organized, you will want to take a look of the following sections under "EO.Web TreeView -> Using EO.Web TreeView" in the documentation:
1. TreeNode and TreeNodeGroup 2. Style and Appearance
Optionally, you can also take a look of the "Look, Skin and Theme" section.
Hope this helps. Let us know if you still have any questions.
Thanks!
|
Rank: Newbie Groups: Member
Joined: 11/2/2011 Posts: 4
|
That is absolutely fantastic - thanks. It's just what I needed - a nudge in the right direction. I've now got the tree view styled as I want it (nothing amazing - just a 'hand' cursor and underline on hover) but of course I can use the ElementStyles if I need to.
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Great! Glad that it helped.
Thanks
|