20

So, I'm kind of new to Xamarin, and I'm trying to figure out how to display a pop-up that has a user-text-input field in it. DisplayAlert doesn't do it because it doesn't have a text-input field. What should I use?

3 Answers 3

22

You can using DisplayPromptAsync. It is from Xamarin Forms, without other plugins.

string result = await DisplayPromptAsync("Question 1", "What's your name?");
Sign up to request clarification or add additional context in comments.

1 Comment

This is the best answer because it uses only "inside the box" functionality.
10

You should try Acr.UserDialogs

NuGet: https://www.nuget.org/packages/Acr.UserDialogs/

GitHub Repo: https://github.com/aritchie/userdialogs

3 Comments

So, I downloaded and installed the nuget package into xamarin, how do i call the method that brings up the dialog?
@JoeDev If you checkout the git repo, they have good examples. This one particularly shows how you can use it. github.com/aritchie/userdialogs/blob/master/src/Samples/Samples/…
@JoeDev To make it clear, I didn't mean git "checkout", I meant check out :)
9

I personally love this nuget (source on github) which allows you to use PopupPage xaml view inside a popup and elegantly as it adds the following methods that look very familiar with what we're all used to:

Navigation.PushPopupAsync()
Navigation.PopPopupAsync()
Navigation.PopAllPopupAsync()
Navigation.RemovePopupPageAsync()

enter image description here

3 Comments

I love this however what I dont see is how to return a variable form the page i think that is what the person is trying to acehieve.
@rogue39nin moving data between views is a common pattern that has its own techniques that'll work with the above approach normally. No need for anything special to achieve that. Same rules apply.
Like microsoft they always leave out nice we simple things like an input dialog but great thank you solved my issue though my dialog is comming up full screen dont no why its a page popup was wanting it to be just a popup.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.