Skip to main content
All docs
V22.1
.NET Standard 2.0+

Customize ShowViewParameters for Built-in Simple Actions

To customize ShowViewParameters, handle the Executed event. If an action owner controller has an event that allows you to customize ShowViewParameters, use this event instead of the Executed event.

The example below demonstrates how to show a DetailView in a modal (popup) window for the New and Edit actions in XAF Windows Forms application.

using DevExpress.ExpressApp;
using DevExpress.ExpressApp.SystemModule;

namespace MainDemo.Module.Controllers {
    public class ChangeWindowTypeToModalController : ViewController<ListView> {
        private void NewObjectAction_Executed(object sender, DevExpress.ExpressApp.Actions.ActionBaseEventArgs e) {
            e.ShowViewParameters.TargetWindow = TargetWindow.NewModalWindow;
        }
        private void ListViewProcessCurrentObjectController_CustomizeShowViewParameters(object sender, CustomizeShowViewParametersEventArgs e) {
            e.ShowViewParameters.TargetWindow = TargetWindow.NewModalWindow;
        }
        protected override void OnActivated() {
            base.OnActivated();
            NewObjectViewController newObjectViewController = Frame.GetController<NewObjectViewController>();
            if (newObjectViewController != null) {
                newObjectViewController.NewObjectAction.Executed += NewObjectAction_Executed;
            }
            ListViewProcessCurrentObjectController listViewProcessCurrentObjectController = Frame.GetController<ListViewProcessCurrentObjectController>();
            if(listViewProcessCurrentObjectController != null) {
                listViewProcessCurrentObjectController.CustomizeShowViewParameters += ListViewProcessCurrentObjectController_CustomizeShowViewParameters;
            }
        }
        protected override void OnDeactivated() {
            NewObjectViewController newObjectViewController = Frame.GetController<NewObjectViewController>();
            if(newObjectViewController != null) {
                newObjectViewController.NewObjectAction.Executed -= NewObjectAction_Executed;
            }
            ListViewProcessCurrentObjectController listViewProcessCurrentObjectController = Frame.GetController<ListViewProcessCurrentObjectController>();
            if(listViewProcessCurrentObjectController != null) {
                listViewProcessCurrentObjectController.CustomizeShowViewParameters -= ListViewProcessCurrentObjectController_CustomizeShowViewParameters;
            }
            base.OnDeactivated();
        }
    }
}