Xamarin.Forms 문서를 참조합니다. 아래 링크 추가 여기에 링크 설명을 입력 하십시오. 누구에게나 해결책이 있습니다. 제발 도와주세요 * DisplayPrompt 구현
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>
씨#
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.";
}
}
}
}
오류 발생 :
1 .CS0103 'DisplayPromptAsync'라는 이름이 현재 컨텍스트에 없습니다.
2. 심각도 코드 설명 프로젝트 파일 줄 억제 상태 억제 상태 오류 "FilterAssemblies"작업이 예기치 않게 실패했습니다. System.IO.FileNotFoundException : 'C : \ Users \ Sharjas KM \ source \ repos \ tEST \ tEST \ tEST \ bin \ Debug \ netstandard2.0 \ tEST.dll'파일을 찾을 수 없습니다. 파일 이름 : 'C : \ Users \ Sharjas KM \ 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 (문자열 경로, FileMode 모드, FileAccess 액세스, Int32 권한, 부울 useRights, FileShare 공유, Int32 bufferSize, FileOptions 옵션, SECURITY_ATTRIBUTES secAttrs, 문자열 msgPath, 부울 bFromProxy, 부울 useLongPath, 부울 checkHost)
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 Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext ()에서 .Execute ()
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다