Events
3 Sep 20204 minutes to read
There are four built-in events in the SfPopupLayout control namely:
- Opening
- Opened
- Closing
- Closed
Opening event
The SfPopupLayout.Opening event will be fired whenever opening the Pop-upView in the view. It can cancel pop-up opening with CancelEventArgs
that contains the following property:
- Cancel: Pop-up opening is based on this value.
//MyViewController.cs
public MyViewController()
{
....
popupLayout = new SfPopupLayout();
popupLayout.Content = GetContentOfPopup();
popupLayout.Opening += PopupLayout_Opening;
this.View.AddSubview(popupLayout);
....
}
private void PopupLayout_Opening(object sender, System.ComponentModel.CancelEventArgs e)
{
e.Cancel = true;
}
Opened event
The SfPopupLayout.Opened event will be fired whenever showing the Pop-upView in the view.
You can execute your own set of codes once the pop-up is opened, and visible in the application in its respective event handler.
//MyViewController.cs
public MyViewController()
{
....
popupLayout = new SfPopupLayout();
popupLayout.Content = GetContentOfPopup();
popupLayout.Opened += PopupLayout_Opened;
this.View.AddSubview(popupLayout);
....
}
private void PopupLayout_Opened(object sender, EventArgs e)
{
// Codes that needs to be executed once popup is visible in the screen.
}
Closing event
The SfPopupLayout.Closing event will be fired whenever closing the Pop-upView in the view. It can cancel pop-up closing with CancelEventArgs
that contains the following property:
- Cancel: Pop-up closing is based on this value.
//MyViewController.cs
public MyViewController()
{
....
popupLayout = new SfPopupLayout();
popupLayout.Content = GetContentOfPopup();
popupLayout.Closing += PopupLayout_Closing;
this.View.AddSubview(popupLayout);
....
}
private void PopupLayout_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
e.Cancel = true;
}
Closed event
The SfPopupLayout.Closed event will be fired whenever dismissing the Pop-upView from the view.
You can execute your own set of codes once the pop-up is completely closed in its respective event handler.
//MyViewController.cs
public MyViewController()
{
....
popupLayout = new SfPopupLayout();
popupLayout.Content = GetContentOfPopup();
popupLayout.Closed += PopupLayout_Closed;
this.View.AddSubview(popupLayout);
....
}
private void PopupLayout_Closed(object sender, EventArgs e)
{
// Codes that needs to be executed once popup is completely closed.
}
Footer button clicked events
Following two events are available in the footer:
- AcceptButtonClicked
- DeclineButtonClicked
AcceptButtonClicked
The SfPopupLayout.PopupView.AcceptButtonClicked will be fired when clicking the Accept button in the pop-up footer. It can cancel pop-up closing with CancelEventArgs
that contains the following property:
- Cancel: Pop-up closing is based on this value.
//MyViewController.cs
public MyViewController()
{
....
popupLayout = new SfPopupLayout();
popupLayout.Content = GetContentOfPopup();
popupLayout.PopupView.AcceptButtonClicked += PopupView_AcceptButtonClicked;
this.View.AddSubview(popupLayout);
....
}
private void PopupView_AcceptButtonClicked(object sender, System.ComponentModel.CancelEventArgs e)
{
e.Cancel = true;
}
DeclineButtonClicked
The SfPopupLayout.PopupView.DeclineButtonClicked will be fired when clicking the Decline button in the pop-up footer. It can cancel pop-up closing with CancelEventArgs
that contains the following property:
- Cancel: Pop-up closing is based on this value.
//MyViewController.cs
public MyViewController()
{
....
popupLayout = new SfPopupLayout();
popupLayout.Content = GetContentOfPopup();
popupLayout.PopupView.DeclineButtonClicked += PopupView_DeclineButtonClicked;
this.View.AddSubview(popupLayout);
....
}
private void PopupView_DeclineButtonClicked(object sender, System.ComponentModel.CancelEventArgs e)
{
e.Cancel = true;
}