728x90
using System.ComponentModel;
using System.Runtime.CompilerServices;
using Maui.ControlTest.Models;
namespace Maui.ControlTest.ViewModels
{
public class MainViewModel : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
private string displayPromptText = "None";
public string DisplayPromptText
{
get
{
return displayPromptText;
}
set
{
displayPromptText = value;
NotifyPropertyChanged();
}
}
public Command DisplayPromptCommand { get; set; }
public MainViewModel()
{
DisplayPromptCommand = new Command(OnDisplayPromptCommand);
}
private async void OnDisplayPromptCommand()
{
DisplayPromptText = await Application.Current.MainPage.DisplayPromptAsync("Input Site", "\r\nWhere do you go to the site?");
}
}
}
사용자에게 입력 받을 값이 있는 경우 사용합니다.
결과
Windows

Android

728x90
'C# > Xamarin Maui' 카테고리의 다른 글
[.NET MAUI] iOS 시뮬레이터가 나타나지 않을때 처리방법 (0) | 2022.09.16 |
---|---|
[.NET MAUI] App Icon, Splash Screen 변경하기 (0) | 2022.09.15 |
[.NET MAUI] TableView 사용하기 (0) | 2022.09.15 |
[.NET MAUI] 화면 Capture 하기 - ScreenShot (0) | 2022.09.15 |
[.NET MAUI] Picker 사용하기 [MVVM/XAML] (0) | 2022.09.14 |