This is a migrated thread and some comments may be shown as answers.

How to hide the Plus Minus of Root Node only

3 Answers 282 Views
Treeview
This is a migrated thread and some comments may be shown as answers.
Haroon
Top achievements
Rank 1
Haroon asked on 30 Jan 2009, 12:48 PM
Hi Telerik,
I just came across an issue and if you can please guide me in this regard.
The issue is that
I want that only the root node (First Node) of tree view dont show its Plus Minus (sign) and it reduce its (only its) indentation as well.
I can see that the property for plus minus is available but that property implements on whole treeview, which is not acceptable to us. And we will need to reduce its indentation as well because if somehow I could be able to hide the plus minus sign the gap between the treeview control border and its first node will look odd.

I hope,I can cleared my point. I wanted to send u the dummy treeview pic to show exactly what I want but i guess attached is not provided this Telerik threads.To understand my application, Its tree view is like that I have One node and all about 100 or so childs and sub childs are under that Single node. So we are looking to hide the Top (Root) node Plus Minus sign and indent the treeview little left to the gap dont look too much.

Looking forward to your quick and helpful response as always.

Regards,
Haroon.

3 Answers, 1 is accepted

Sort by
0
Martin Vasilev
Telerik team
answered on 02 Feb 2009, 04:44 PM
Hello Haroon,

Thank you for writing.

The Telerik Forums do not allow attachments for security purposes - if you would like to send us your code, you will need to start a support ticket.

You can hide the +/- symbol by collapsing image element in Layout event:
 
void radTreeView1_Layout(object sender, LayoutEventArgs e)  
{  
    this.radTreeView1.TreeViewElement.Children[1].Children[0].Visibility = Telerik.WinControls.ElementVisibility.Collapsed;  

Unfortunately, there is not a way to remove the node indent and show it at the left edge.
 
Do not hesitate to contact me again if you have other questions.

Best wishes,
Martin Vasilev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Haroon
Top achievements
Rank 1
answered on 03 Feb 2009, 06:32 AM
Hi Martin Vasilev and Telerik team,
The telerik Team continues with their extra ordinary support (Y).

Well i tried the above code in my project and its working as per expected, but the empty space is giving a little odd look. I really appreciate  if you can give me some idea / trick to  make it feel like left indented . I was thinking about dragging the treeview control behind the left border. But in that case i have to manually set the controls location every time user change form location or resize, which i don't think i will do. Right now I have dock= Full the control to a panel. which saves me from lot of coding.

Looking forward to your quick reply.

Regards,
Haroon.
0
Victor
Telerik team
answered on 05 Feb 2009, 12:10 PM
Hello Haroon,

Thank you for writing.
 
I am afraid that what you need a somewhat non-standart feature. If we remove the tree indentation it is not a tree anymore. Currently the tree indentation is applied to every level and is hardcoded to be at least 16 pixels. If we were able to set it to 0, it will become a list, not a tree, with no indentation whatsoever.


Greetings,
Victor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Treeview
Asked by
Haroon
Top achievements
Rank 1
Answers by
Martin Vasilev
Telerik team
Haroon
Top achievements
Rank 1
Victor
Telerik team
Share this question
or