Avoid Raising ValidatingItem on Add Button Click

Environment

Product Version 2018.3.1016
Product RadDataForm for WPF

Description

How to avoid raising validation when the Add button of RadDataForm gets clicked.

Solution

Create a custom DataFormCommandProvider and override its AddNew method. In the method call only the AddNewItem method of RadDataForm.

public class CustomCommandProvider : DataFormCommandProvider 
{ 
    public CustomCommandProvider() : base(null) 
    { 
    } 
    public CustomCommandProvider(RadDataForm dataForm) 
            : base(dataForm) 
    { 
        this.DataForm = dataForm; 
    } 
 
    protected override void AddNew() 
    { 
        if (this.DataForm != null) 
        { 
            this.DataForm.AddNewItem(); 
        } 
    } 
} 
Then assign the custom provider to the CommandProvider property of RadDataForm.

this.radDataForm.CommandProvider = new CustomCommandProvider(this.radDataForm); 

See Also

In this article
Not finding the help you need? Improve this article