Skip to main content
.NET Framework 4.5.2+

ShowViewParameters Class

Represents a set of parameters used to display a new View.

Namespace: DevExpress.ExpressApp

Assembly: DevExpress.ExpressApp.v24.1.dll

NuGet Package: DevExpress.ExpressApp

Declaration

public class ShowViewParameters

Remarks

When you handle the Execute event of an ActionBase class descendant, you can specify a View that XAF displays after Action execution. For this purpose, use the ShowViewParameters object passed as the event’s ActionBaseEventArgs.ShowViewParameters parameter.

You can use the following parameter properties to specify View attributes:

Parameter Property Description
ShowViewParameters.CreatedView The created View.
ShowViewParameters.TargetWindow The type of the Window that should contain the created View.
ShowViewParameters.Context A Template context for the target Window.
ShowViewParameters.Controllers The Controllers activated for the View and the Window.

The following example demonstrates how to use a ShowViewParameters object in an Action’s Execute event handler. The code customizes the Accept Action:

using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Actions;
using DevExpress.ExpressApp.SystemModule;
using MainDemo.Module.BusinessObjects;

namespace YourApplicationName.Blazor.Server.Controllers {
    public class ShowViewController : ViewController {
        SimpleAction showViewAction;

        public ShowViewController() {
            showViewAction = new SimpleAction(this, "ShowEmployeesList", DevExpress.Persistent.Base.PredefinedCategory.Edit);
            showViewAction.Execute += ShowViewAction_Execute;
        }

        private void ShowViewAction_Execute(object sender, SimpleActionExecuteEventArgs e) {
            IObjectSpace objectSpace = Application.CreateObjectSpace(typeof(Employee));
            string listViewId = Application.FindListViewId(typeof(Employee));
            e.ShowViewParameters.CreatedView = Application.CreateListView(
               listViewId,
               Application.CreateCollectionSource(objectSpace, typeof(Employee), listViewId),
               true);
            e.ShowViewParameters.TargetWindow = TargetWindow.NewModalWindow;
            var dlgCnt = Application.CreateController<DialogController>();
            dlgCnt.Accepting += DlgCnt_Accepting;
            e.ShowViewParameters.Controllers.Add(dlgCnt);
        }

        private void DlgCnt_Accepting(object sender, DialogControllerAcceptingEventArgs e) {
            // Add your custom code here.
        }
    }
}

Note

XAF creates a DialogController for Pop-up Windows by default.

XafApplication.ShowViewStrategy manages Window and View visibility. This strategy may use properties of a ShowViewParameters object. In some scenarios, you may need to call the ShowViewStrategyBase.ShowView method to display a View. In this case, create a ShowViewParameters object and pass it as a parameter.

Inheritance

Object
ShowViewParameters
See Also