View.Refresh() Method
Refreshes displayed values of the View‘s controls with new values from the data source collection (not from the database itself).
Namespace: DevExpress.ExpressApp
Assembly: DevExpress.ExpressApp.v24.2.dll
NuGet Package: DevExpress.ExpressApp
Declaration
Remarks
Use this method to manually refresh control values in the current View when displayed objects do not raise notifications on data changes themselves (e.g., when the object type does not support INotifyPropertyChanged, or when the data source does not support IBindingList). The Refresh method refreshes data from the data source but does not reload the data source itself. To reload data from the database, use another overload of this method that takes the refreshDataSource parameter.
The following example uses a Parametrized Action to create a new Department object and refresh the Detail View. The new department becomes available in the Contact.Department Lookup List View.
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Actions;
using DevExpress.Persistent.Base;
using MainDemo.Module.BusinessObjects;
// ...
public class AddDepartmentController : ObjectViewController<DetailView, Contact> {
public AddDepartmentController() {
ParametrizedAction addDepartmentAction = new ParametrizedAction(
this, "AddDepartment", PredefinedCategory.Edit, typeof(string));
addDepartmentAction.Execute += AddDepartmentAction_Execute;
}
private void AddDepartmentAction_Execute(object sender, ParametrizedActionExecuteEventArgs e) {
using(IObjectSpace objectSpace = Application.CreateObjectSpace(typeof(Department))) {
Department department = objectSpace.CreateObject<Department>();
department.Title = e.ParameterCurrentValue as string;
objectSpace.CommitChanges();
}
View.Refresh();
}
}