728x90
728x170
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
그리드형
Posted by kjun.kr
,