Hi all,
I just went over a *lot* of tree node style properties (LeftNodeStyle,
NodeStyle, ParentNodeStyle, RootNodeStyle, LevelStyles, HoverNodeStyle,
SelectedNodeStyle, etc etc etc) but can't find exactly what I want.
It seems that I'm in a situation where none of these predefined groups fit
the bill. Ultimately, the style to use needs to be decided as I'm
dynamically adding individual nodes through code. I'd like to do this:
if( [some convoluted conditions] ) {
tnNewNode = new TreeNode( strCaption );
tnNewNode.[Something] = "bold";
tnParent.ChildNodes.Add( tnNewNode );
}
It's this [Something] property that I'm looking for--one that applies to an
individual node, but not necessarily others that happen to fall in some
common category.
I've managed to add separate styles for clickable nodes by using something
like:
.MyTreeClass a
{
(styles that apply to all clickable nodes, which all happen to have an
archor tag)
}
...but I need finer granularity. Thinking along the same way, I've hacked
together the following:
tnNewNode = new TreeNode( "<div class='clsTest'>" + strCaption + "</div>" );
and in my .css file:
.MyTreeClass .clsTest
{
font-weight: bold;
}
But this is *so* ugly I can't help but think there's just gotta be some
better way to do this than force my own div around the node's text.
Brandon Gano - 23 Jul 2007 23:58 GMT
I think the CssClass property is the [Something] you are looking for.
--code--
if (...) {
tnNewNode = new TreeNode(strCaption);
tnNewNode.CssClass = "BoldNode";
tnParent.ChildNodes.Add(tnNewNode);
}
--css--
.MyTreeClass .BoldNode {
font-weight:bold;
}
> Hi all,
>
[quoted text clipped - 40 lines]
> But this is *so* ugly I can't help but think there's just gotta be some
> better way to do this than force my own div around the node's text.
Homer J. Simpson - 24 Jul 2007 14:03 GMT
>I think the CssClass property is the [Something] you are looking for.
>
[quoted text clipped - 9 lines]
> font-weight:bold;
> }
I'm gonna have to try it regardless of that IntelliSense is telling me. It
definitely did *not* popup the .CssClass property (that's the first thing I
was looking for).