.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
.NET Core 3.0+

View.Refresh(Boolean) Method

Refreshes displayed values of the View's controls with new values from the data source collection (and optionally, from the database itself).

Namespace: DevExpress.ExpressApp

Assembly: DevExpress.ExpressApp.v19.2.dll

Declaration

public void Refresh(
    bool refreshDataSource
)
Public Sub Refresh(
    refreshDataSource As Boolean
)
public void Refresh(
    bool refreshDataSource
)
Public Sub Refresh(
    refreshDataSource As Boolean
)
public void Refresh(
    bool refreshDataSource
)
Public Sub Refresh(
    refreshDataSource As Boolean
)

Parameters

Name Type Description
refreshDataSource Boolean

true, if the data source needs to be refreshed as well; otherwise, false.

Parameters

Name Type Description
refreshDataSource Boolean

true, if the data source needs to be refreshed as well; otherwise, false.

Parameters

Name Type Description
refreshDataSource Boolean

true, if the data source needs to be refreshed as well; otherwise, false.

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 calls View.RefreshDataSource when the refreshDataSource parameter is set to true.

The following example uses a Parametrized Action to search for a Person by LastName, and then assigns all deferred tasks to that person.

using System.Collections.Generic;
using DevExpress.Data.Filtering;
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Actions;
using DevExpress.Persistent.Base;
using DevExpress.Persistent.Base.General;
using DevExpress.Persistent.BaseImpl;
using MainDemo.Module.BusinessObjects;
// ...
public class AssignTasksController : ViewController {
    public AssignTasksController() {
        TargetObjectType = typeof(DemoTask);
        ParametrizedAction assignTasksAction = new ParametrizedAction(
            this, "AssignTasks", PredefinedCategory.Edit, typeof(string));
        assignTasksAction.Execute += AssignTasksAction_Execute;
    }
    private void AssignTasksAction_Execute(object sender, ParametrizedActionExecuteEventArgs e) {
        using(IObjectSpace objectSpace = Application.CreateObjectSpace()) { 
            string personParamValue = e.ParameterCurrentValue as string;
            CriteriaOperator personCriteria = CriteriaOperator.Parse("Contains([LastName], ?)", personParamValue);
            Person person = objectSpace.FindObject<Person>(personCriteria);
            if(person != null) {
                CriteriaOperator taskCriteria = CriteriaOperator.Parse("[Status] = ?", TaskStatus.Deferred);
                IList<DemoTask> tasks = objectSpace.GetObjects<DemoTask>(taskCriteria);
                foreach(DemoTask task in tasks) {
                    task.AssignedTo = person;
                }
                objectSpace.CommitChanges();
            }
        }
        View.Refresh(true);
    }
}
See Also