New to Telerik UI for WinForms? Download free 30-day trial

Building TPF Based Controls

RadControls are built by composing RadElement trees instead of overriding the OnPaint method. Elements can take the form of lightweight primitive elements that draw the individual parts of a control to the form, layout elements that are responsible for arranging primitives on the form, and component elements that handle user input and are responsible for creating layout and primitive elements. Elements can be nested to any arbitrary level of complexity.

  • A number of pre-built primitives are available for building themable user interfaces quickly including text, gradient fills, borders, checks, arrows, lines, radio buttons, images and trackbars.

  • Elements combine primitives to form the basis of a functioning control. For example, RadLabelElement combines a BorderPrimitive, FillPrimitive and TextPrimitive, then adds specific label properties TextAlignment and BorderVisible.

  • Layout elements descending from LayoutPanel manage the arrangement of child elements. For example, StackLayoutPanel arranges elements in a horizontal or vertical stack that may wrap to new lines. StripLayoutPanel orders elements in a single vertical or horizontal line.

  • RadControls are typically thin wrappers around a component element, handle any direct communication with Windows and establish communication to the RadElement tree by creating a root element and adding elements to the root element. RadLabel for example simply creates a root element and then creates and adds a RadLabelElement to the root element.

See Also

In this article