Horizontal indent of rows

15 posts, 0 answers
  1. Phil
    Phil avatar
    4 posts
    Member since:
    Mar 2011

    Posted 14 Mar 2011 Link to this post

    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
  2. Vanya Pavlova
    Admin
    Vanya Pavlova avatar
    2019 posts

    Posted 15 Mar 2011 Link to this post

    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!
  3. DevCraft banner
  4. Rodney Foley
    Rodney Foley avatar
    54 posts
    Member since:
    Oct 2009

    Posted 04 Mar 2012 Link to this post

    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.
  5. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 06 Mar 2012 Link to this post

    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 >>
  6. Vanya Pavlova
    Admin
    Vanya Pavlova avatar
    2019 posts

    Posted 06 Jun 2013 Link to this post

    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.

  7. Randy
    Randy avatar
    6 posts
    Member since:
    Mar 2012

    Posted 02 Feb 2015 Link to this post

    How does one remove the indent completely?  Setting HierarchyIndent to 0 does not remove it.
  8. Rodney Foley
    Rodney Foley avatar
    54 posts
    Member since:
    Oct 2009

    Posted 03 Feb 2015 in reply to Randy Link to this post

    @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.  
  9. Randy
    Randy avatar
    6 posts
    Member since:
    Mar 2012

    Posted 03 Feb 2015 in reply to Rodney Foley Link to this post

    Fabulous idea, sadly I had tried and failed.  Great minds do think alike!
  10. Rodney Foley
    Rodney Foley avatar
    54 posts
    Member since:
    Oct 2009

    Posted 03 Feb 2015 in reply to Randy Link to this post

    Sorry @Randy, and I guess so. However it would be a great feature request for the control to help remove the indent. :)
  11. Randy
    Randy avatar
    6 posts
    Member since:
    Mar 2012

    Posted 03 Feb 2015 in reply to Rodney Foley Link to this post

    Good point.  Submitted a support ticket so waiting to hear back before any next steps are taken.  Thanks for replying!
  12. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 05 Feb 2015 Link to this post

    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.

     
  13. Rodney Foley
    Rodney Foley avatar
    54 posts
    Member since:
    Oct 2009

    Posted 05 Feb 2015 in reply to Dimitrina Link to this post

    @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.




  14. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 09 Feb 2015 Link to this post

    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.

     
  15. james
    james avatar
    2 posts
    Member since:
    Mar 2016

    Posted 08 Mar in reply to Dimitrina Link to this post

    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);
            }
        }
    }

  16. james
    james avatar
    2 posts
    Member since:
    Mar 2016

    Posted 08 Mar in reply to james Link to this post

    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.
Back to Top
DevCraft banner