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

Horizontal indent of rows

14 Answers 133 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
Phil
Top achievements
Rank 1
Phil asked on 14 Mar 2011, 07:03 PM
Howdy,

Is there any way to change the horizontal white space (indent) for nested rows? It's a little to "wide" for my tastes; I'd like indentation of about half the width of the default for the control.

Cheers
Phil

14 Answers, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 15 Mar 2011, 11:34 AM
Hi Phil,

 
With the current implementation of RadTreeListView and the internal structure of TreeListViewRow you cannot directly change the postion of the ExpanderButton and the space around it on the different levels. I strongly recommend to use the default behavior of the TreeListViewRow. 

Regards,
Vanya Pavlova
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Rodney Foley
Top achievements
Rank 1
answered on 05 Mar 2012, 04:06 AM
That is great an all, but the default isn't good for everyone, so could you please share HOW it can be done.  There are lots of things that cannot be directly changed with Rad Controls but you guys have always helped show how to change them via styles or other means. This reply is shocking.

I personally need decrease the indention to almost nothing as it is way to much on a hierarchy as deep as the one currently have to deal with it shows a lot of wasted space, and it would be really nice to be able to control this.  

Please someone at Telerik show us the secret sauce on indention for the RadTreeListView.
0
Dimitrina
Telerik team
answered on 06 Mar 2012, 02:00 PM
Hi,

Due to the template structure of the RadTreeListView this could not be implemented. Unfortunately there is not a "How to".

Greetings,
Didie
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Vanya Pavlova
Telerik team
answered on 06 Jun 2013, 07:50 AM
Hello @Phil, @Rodney,



As a kind of follow up just to let you know that RadTreeListView exposes a HierarchyIndent property, which you can use to control the horizontal indent of nested items.
Have a great day!



Regards,
Vanya Pavlova
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Randy
Top achievements
Rank 1
answered on 03 Feb 2015, 04:55 AM
How does one remove the indent completely?  Setting HierarchyIndent to 0 does not remove it.
0
Rodney Foley
Top achievements
Rank 1
answered on 03 Feb 2015, 03:44 PM
@Randy, a suggestion if you have tried it already, would be to see if you can set it to a negative value. I haven't tested this with that property on that control, however negative values in WPF typically are valid and can solve issues like this.  
0
Randy
Top achievements
Rank 1
answered on 03 Feb 2015, 03:56 PM
Fabulous idea, sadly I had tried and failed.  Great minds do think alike!
0
Rodney Foley
Top achievements
Rank 1
answered on 03 Feb 2015, 04:04 PM
Sorry @Randy, and I guess so. However it would be a great feature request for the control to help remove the indent. :)
0
Randy
Top achievements
Rank 1
answered on 03 Feb 2015, 04:06 PM
Good point.  Submitted a support ticket so waiting to hear back before any next steps are taken.  Thanks for replying!
0
Dimitrina
Telerik team
answered on 05 Feb 2015, 12:01 PM
Hi,

I am posting here the answer provided in the support thread:
Generally, you can set RadTreeListView's HierarchyIndent property in order to control the horizontal indent of nested items. As it turns out it does not work properly hiding the indent at all. Would you please share why do you need to remove the indentation? In case you need a Flat structure, I would suggest you using RadGridView instead. 

Regards,
Dimitrina
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Rodney Foley
Top achievements
Rank 1
answered on 05 Feb 2015, 03:55 PM
@Dimitrina,

Thanks for talking with them and providing their response.

I would have to say that removing the indent of nested items should be allowed because its WPF, and you can really do anything with it one way or another. Also you are imposing your judgements on how another developer wants to use a control. They could have 10 good reasons why they want to use it in a way that the vendor does agree with, however the vendor shouldn't not block their customers from innovating or allow them to use the controls in a new previously on thought of way that works in the way the customers needs or wants it to.

Suggesting that you should use a GridView instead of a TreeListView, is like say use a ListView and use a data template and styling to make it look like a GridView. It shouldn't really matter why a customers wants to do something a vendor didn't think about with their controls, the vendor should just be helping to facilitate the needs of the customer. 

Don't get me wrong there is nothing wrong with suggesting to use alternative controls to solve a presented customer problem so as long as you also provide the solution to what they customer wanted as well along with it. This will allow the customer to review both options to see which one is best for their situation. The customer may then take your recommendation to use another control they didn't think about or they may take the solution they asked for. Either way you made a customer happy and solved their problem, the alternative is you are not solving their problem and frustrating them if they feel you are trying to force them in a direction they may not agree with or be ready to look at.




0
Dimitrina
Telerik team
answered on 09 Feb 2015, 12:34 PM
Hi Rodney,

Thank you for sharing your feedback. It is indeed reasonable and client oriented and we will do our best to further improve our service.

As to the particular issue, this seems to be a missing functionality with RadTreeListView control which we should consider and investigate further. I have logged it into our feedback portal, so that other clients can also follow its progress: Controlling horizontal indent of nested rows.

Regards,
Dimitrina
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
james
Top achievements
Rank 1
answered on 08 Mar 2016, 08:59 PM

An inelegant hack to solve this problem is to dynamically adjust the margins in the CellLoaded event. This worked for me.

private void _treeView_CellLoaded(object sender, Telerik.Windows.Controls.GridView.CellEventArgs e)
{
    var cell = e.Cell;
    if (cell != null && cell.ParentRow != null)
    {
        var rowItem = cell.ParentRow.Item as MyRowType;
        if (rowItem != null)
        {
            // shift all cells to the left
            cell.Margin = new Thickness(-_treeView.HierarchyIndent, 0,
_treeView.HierarchyIndent, 0);
        }
    }
}

0
james
Top achievements
Rank 1
answered on 08 Mar 2016, 09:08 PM
I forgot to mention that you have to set the TreeListView's HierarchyIndent to 0 in the XAML in order for the above code to work. Then in the code above replace _treeView.HierarchyIndent with 20 since that's the default value.
Tags
TreeListView
Asked by
Phil
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Rodney Foley
Top achievements
Rank 1
Dimitrina
Telerik team
Randy
Top achievements
Rank 1
james
Top achievements
Rank 1
Share this question
or