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

Question about navigating root element tree

2 Answers 140 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jason
Top achievements
Rank 1
Jason asked on 06 Feb 2012, 05:29 PM
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 Answers, 1 is accepted

Sort by
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 07 Feb 2012, 04:56 PM
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;
}
0
Richard Slade
Top achievements
Rank 2
answered on 08 Feb 2012, 10:58 AM
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
Tags
General Discussions
Asked by
Jason
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
Share this question
or