The PopupWindowShowAction class inherits the basic functionality of Actions from the ActionBase class. Pop-up Window Show Actions are used to invoke a pop-up Window with a specified View and execute custom code when an end-user clicks the accept or cancel button. To specify the View to be displayed, handle the CustomizePopupWindowParams event and set the required View to the handler's CustomizePopupWindowParamsEventArgs.View parameter. An example of using this approach is shown below.
C# |
public class ShowPopupViewController : ObjectViewController<ObjectView, DemoObject> {
public ShowPopupViewController() {
new PopupWindowShowAction(this, "ShowPopup",
PredefinedCategory.View).CustomizePopupWindowParams += (s, e) => {
IObjectSpace objectSpace = e.Application.CreateObjectSpace(typeof
(PopupInfoDemoObject));
DetailView detailView = e.Application.CreateDetailView(objectSpace,
new PopupInfoDemoObject(ViewCurrentObject));
detailView.ViewEditMode = ViewEditMode.Edit;
e.View = detailView;
e.Maximized = true;
};
}
}
|
VB |
Public Class ShowPopupViewController
Inherits ObjectViewController(Of ObjectView, DemoObject)
Public Sub New()
AddHandler CType(New PopupWindowShowAction(Me, "ShowPopup", PredefinedCategory.View), _
PopupWindowShowAction).CustomizePopupWindowParams, Sub(s, e)
Dim objectSpace As IObjectSpace = e.Application.CreateObjectSpace(GetType_
(PopupInfoDemoObject))
Dim detailView As DetailView = e.Application.CreateDetailView(objectSpace, _
New PopupInfoDemoObject(ViewCurrentObject))
detailView.ViewEditMode = ViewEditMode.Edit
e.View = detailView
e.Maximized = True
End Sub
End Sub
End Class
|
In the code above, the new PopupWindowShowAction object is created to invoke a pop-up window for the particular View when the CustomizePopupWindowParams event raises. The CustomizePopupWindowParamsEventArgs.Maximized property is set to true, thus the pop-up window will expand to occupy the whole space.
To process end-user clicks on the accept and cancel buttons, handle the Execute and Cancel events, respectively. Built-in Action Containers display Pop-up Window Show Actions via a button.
To add a Pop-up Window Show Action to a Controller, drag and drop the PopupWindowShowAction item from the XAF Actions section on the Toolbox to the required Controller's Designer area (see Add an Action that Displays a Pop-up Window). You can also use the ActionAttribute to convert a business class' method to an Action that displays a non-persistent object in a popup (see How to: Create an Action Using the Action Attribute).
System.Object
System.MarshalByRefObject
System.ComponentModel.Component
ActionBase
PopupWindowShowAction