I refer Xamarin.Forms docs. the link add below enter link description here Please anyone has a solution Please help me * DisplayPrompt implementation
XAML:
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
x:Class="tEST.MainPage">
<StackLayout Margin="20,35,20,20">
<Label Text="Display Prompt"
FontSize="Large"
HorizontalOptions="Center" />
<Button Text="Question 1"
Clicked="OnQuestion1ButtonClicked" />
<Label x:Name="question1ResultLabel" />
<Button Text="Question 2"
Clicked="OnQuestion2ButtonClicked" />
<Label x:Name="question2ResultLabel" />
</StackLayout>
</ContentPage>
C#
using System;
using Xamarin.Forms;
namespace tEST
{
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
}
async void OnQuestion1ButtonClicked(object sender, EventArgs e)
{
string result = await DisplayPromptAsync("Question 1", "What's your name?");
if (!string.IsNullOrWhiteSpace(result))
{
question1ResultLabel.Text = $"Hello {result}.";
}
}
async void OnQuestion2ButtonClicked(object sender, EventArgs e)
{
string result = await DisplayPromptAsync("Question 2", "What's 5 + 5?", maxLength: 2, keyboard: Keyboard.Numeric);
if (!string.IsNullOrWhiteSpace(result))
{
int number = Convert.ToInt32(result);
question2ResultLabel.Text = number == 10 ? "Correct." : "Incorrect.";
}
}
}
}
Getting errors:
1.CS0103 The name 'DisplayPromptAsync' does not exist in the current context
2.Severity Code Description Project File Line Suppression State Suppression State Error The "FilterAssemblies" task failed unexpectedly. System.IO.FileNotFoundException: Could not find file 'C:\Users\Sharjas K M\source\repos\tEST\tEST\tEST\bin\Debug\netstandard2.0\tEST.dll'. File name: 'C:\Users\Sharjas K M\source\repos\tEST\tEST\tEST\bin\Debug\netstandard2.0\tEST.dll' at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share) at Xamarin.Android.Tasks.FilterAssemblies.Execute() at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext()
