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

CRUD Operations Support

The DataForm supports data operations such as adding, editing, and removing data items.

To provide better understanding on how these operations work, you need to be aware of the way the DataForm source collection is set—the Source property accepts IEnumerable values and manages them in a different manner depending on the data operation.

Adding Items

The DataForm provides the Add operation, which becomes available only when either of the following conditions is met:

  • The collection is an IList without a fixed size and with a public default constructor.

  • The collection implements an Add method and has a public default constructor. The Add method requires a single parameter, which is the object you want to add to your collection.

Removing Items

Similar to the Add operation, you can remove items only if wither of the following conditions are met:

  • The collection is an IList without a fixed size.

  • The collection implements a Remove method with a single parameter, which is the object that will be removed from the collection.

Editing Items

If the current item is not null and the DataForm is not in edit mode, the Edit button will be enabled and the editing functionality will be available.

If the items of the data source implement the IEditableObject or the INotifyPropertyChanged interface, you will be able to revert any pending changes with the Cancel button. In this case, you have to set the EnablePropertyChangedBasedCancel property of the DataForm to True.

EnablePropertyChangedBasedCancel is not supported when the DataForm utilizes custom data templates.

The DataForm provides options for editing types that do not implement the IEditableObject or INotifyPropertyChanged interfaces. In such cases, however, the cancel edit feature will not be available and the Cancel button will not be enabled.

  • For more information on the behavior of the Save and Cancel buttons, refer to the article on AutoCommit Settings.
  • For detailed explanations on implementing the IEditableObject, refer to this MSDN article.

Automatic Editing

The DataForm exposes the AutoEdit property, which indicates whether the component will automatically enter its edit mode when users load or navigate between items. By default, AutoEdit is disabled and is set to False. To enable the edit mode of the DataForm by default and avoid the need for users to explicitly click the Edit button every time they want to edit a record, set AutoEdit to True.

Setting AutoEdit to True removes the Add button and the user won't be able to add new entries.

See Also

In this article
Not finding the help you need?