-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMessagePopup.xaml.cs
More file actions
36 lines (30 loc) · 1.07 KB
/
MessagePopup.xaml.cs
File metadata and controls
36 lines (30 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using CommunityToolkit.Maui;
using CommunityToolkit.Maui.Views;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
namespace PopupV2NavigationWithParameters;
public partial class MessagePopup : Popup
{
public MessagePopup(MessagePopupVm vm)
{
InitializeComponent();
BindingContext = vm;
Opened += MessagePopup_Opened;
}
private void MessagePopup_Opened(object? sender, EventArgs e)
{
}
}
public record MessagePopupVmInitData(string Title, string Message);
public partial class MessagePopupVm(IPopupService popupService) : ObservableObject, IPopupViewModel<MessagePopupVmInitData>
{
private readonly IPopupService popupService = popupService;
[ObservableProperty] string _message = "Help... i'm empty :(", title = "No title :(";
public void Init(MessagePopupVmInitData initData)
{
Title = initData.Title;
Message = initData.Message;
}
[RelayCommand]
private void Close() => popupService.ClosePopupAsync(Application.Current?.Windows[0]?.Page?.Navigation);
}