Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
236
Padding around tree.
posted

Hi people,

I have a bit of a problem with the UltraTree. I want to create room to the left of the tree, because I want to draw an arrow in front of the currently selected node. I've tried using both the Padding and Margin properties of the tree, but they don't seem to do anything. I've set the Indent property to 0, to make the ExpansionIndicators and connecting lines disappear, but this also means I don't have any room to draw the arrow. What's the best way to achieve the spacing in front/around the tree?

Greets,

Floris

Parents
No Data
Reply
  • 236
    posted

    I got it working. In case anybody else is interested here's how I did it:

     

    I found a tool that allows me to view which UIElements are in the control you want to modify. More information can be found here: http://geekswithblogs.net/devin/archive/2005/11/17/60406.aspx

    With the aid of this tool I identified which UIElements I needed to modify. I then wrote a simple CreationFilter to move everything a little bit to the left. Here's the code:

        class MoveTree : IUIElementCreationFilter

        {

            public bool BeforeCreateChildElements(UIElement parent)

            {

                if (parent is TreeNodeUIElement)

                {

                    parent.Offset(20, 0);

                }

                //Returning false means we don't want to intervene in the creation of child elements.

                return false;

            }

     

            public void AfterCreateChildElements(UIElement parent)

            {

                return;

            }

        }

Children