Question about navigating root element tree

3 posts, 1 answers
  1. Jason
    Jason avatar
    10 posts
    Member since:
    Aug 2011

    Posted 06 Feb 2012 Link to this post

    Hi,

    I would like to programmatically get to some of the hidden properties that I can see in the Element Hierarchy Editor, but don't see an obvious way to do so.

    For instance, a RadButton has a root element and then a Fill Primitive, Layout, Focus, Border, etc. Drop down lists have other goodies in there. How does one get there in c#?

    Is it something like this, but then casting it to something else? For instance..
    (FillPrimitive) btnFoo.RootElement.children[0]

    It would be really nice to know how to navigate the tree because there are a lot of properties that we could take advantage of.
    Thanks.
    Jason



  2. Answer
    Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 07 Feb 2012 Link to this post

    Hi Jason,

    Yes, the idea is that you can drill down through the hierarchy of elements as per the "Edit UI Elements" Smart Tag. For exmaple, to change the style of the border on a button to be dashed.

    Also which might help is this link on the hierarchy editor and this link on RadControlSpy

    If you need any further help, then let me know
    Richard
    Telerik.WinControls.Primitives.BorderPrimitive border = (Telerik.WinControls.Primitives.BorderPrimitive)this.radButton1.ButtonElement.Children[2];
    if (border != null)
    {
        border.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
    }
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 08 Feb 2012 Link to this post

    Hi Jason,

    Forgot to say, please remember to mark as answer if this helps. If you need more information though, then just let me know
    Richard
Back to Top