anand
anand

Reputation: 1459

How to close popup layout on outside click?

I am working in xamarin forms. I am usng PopupLayout control to show the popup on screen. Now I want that if user click outside the popup popup should be dismiss. How I can do this? What property of PopupLayout I can use?

Regards, Anand Dubey

Upvotes: 2

Views: 1486

Answers (1)

hvaughan3
hvaughan3

Reputation: 11105

One way to do this is to have a transparent ContentView covering the screen. Add a GestureRecognizer to the ContentView which, when clicked, will hide the PopupControl.

When the PopupControl is not showing, set ContentView.InputTransparent to true so clicks do not register, or remove the ContentView from the screen completely.

When you show the PopupControl, set ContentView.InputTransparent to false or add in the ContentView if you removed it.

Upvotes: 1

Related Questions