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

Customizing Buttons

The RadDataForm control provides API for customizing some of the buttons in the UI.

By default RadDataForm displays a set of buttons on top of the control which allows, you to modify or change the current data item. To change the visibility of the buttons CommandButtonsVisibility property of RadDataForm. The property is of type DataFormCommandButtonsVisibility and contains the following values.

  • None: No buttons are displayed.
  • Add: The add new item button is displayed.
  • Delete: The delete item button is displayed.
  • Edit: The edit item button is displayed.
  • Navigation: The move next, move previous, move to first and move to last buttons are displayed.
  • Commit: The save changes button is displayed.
  • Cancel: The cancel button is displayed.
  • All: All buttons are displayed.

DataFormCommandButtonsVisibility is a flag enum which means that you can use multiple values with the CommandButtonsVisibility property.

The following code example shows how to display only the navigation, edit, commit and cancel buttons, omitting the add and delete buttons.

Example 1: Setting the command buttons visibility

<telerik:RadDataForm CommandButtonsVisibility="Navigation,Edit,Commit,Cancel" /> 

The control allows also to customize the commit and cancel buttons. To change the content in the commit button ("Save" by default), set the CommitButtonContent property of RadDataForm. To change the content of the cancel button ("Cancel" by default), set the CancelButtonContent property.

Example 2: Setting commit and cancel buttons content

  <telerik:RadDataForm CommitButtonContent="Update" CancelButtonContent="Abandon"/> 

To change the style of the commit button, set the CommitButtonStyle property of RadDataForm. To change the style of the cancel button, set the CancelButtonStyle property.

Example 3: Setting commit and cancel buttons content

<telerik:RadDataForm CommitButtonContent="Update" CancelButtonContent="Abandon"> 
        <Style TargetType="telerik:RadButton"> 
            <Setter Property="Background" Value="#0078D7" /> 
            <Setter Property="Foreground" Value="White" /> 
        <Style TargetType="telerik:RadButton"> 
            <Setter Property="Background" Value="#EA4335" /> 
            <Setter Property="Foreground" Value="White" /> 

The commit and save buttons will be disabled and colored in gray when the data form is not in edit mode, regardless of the button styles. Changes in the buttons colors will be applied when the data form control enters edit mode.

See Also

In this article
Not finding the help you need?