Edit this page

Styling DataFormDataField

Before reading this topic, you might find useful to get familiar with theTemplate Structure of the DataFormDataField control.

The RadDataForm fields can be styled by creating an appropriate Style and setting it to the DataFieldStyle property of the RadDataForm.

You have two options:

  • To create an empty style and set it up on your own.

  • To copy the default style of the control and modify it.

This topic will show you how to perform the second one.

Modifying the Default Style

Load your project in Expression Blend and open the User Control that holds the RadDataForm. You have to use a dummy control in order to get the default style. To create one, find the DataFormDataField control in the 'Assets' and draw one on the art board. In the 'Objects and Timeline' pane select the DataFormDataField that you've drawn and from the menu choose Object -> Edit Style -> Edit a Copy. You will be prompted for the name of the style and where to be placed.

If you choose to define the style in Application, it would be available for the entire application. This allows you to define a style only once and then reuse it where needed.

After clicking 'OK', Expression Blend will generate the default style of the DataFormDataField control in the Resources section of your User Control. The properties available for the style will be loaded in the 'Properties' pane and you will be able to modify their default values. You can also edit the generated XAML in the XAML View or in Visual Studio.

To apply the style to the real cells, set it to the DataFieldStyle property of the RadDataForm.

Example 1: Setting RadDataForm's DataFieldStyle

<telerik:RadDataForm x:Name="dataForm" DataFieldStyle="{StaticResource DataFormDataFieldStyle}"/>