@aluzi liu , Welcome to Microsoft Q&A, based on my test, I reproduced your problem when using ToastScenario.Reminder
.
There are two methods to let toast notification keep display until user click on it.
First method, we need to add a button to the ToastContentBuilder, like the following code:
var builder = new ToastContentBuilder()
.AddArgument("Action", "NewToast")
.AddArgument("ActionData", "");
//The documentation says set scenario to "reminder" will keep the toast display, but not work at all..
//And the "ExpirationTime" property is also not working...
builder.SetToastScenario(ToastScenario.Reminder);
builder.AddText("2023-03-08")
.AddText("test1")
.AddButton(new ToastButton()
.SetContent("Text reply"))
.AddText("My Idead")
.Show();
You could refer to the Microsoft Learning Reminders, which has the following description:
You must provide at least one button on your app notification. Otherwise, the notification will be treated as a normal notification.
Therefore, we have to add a button in the ToastContentBuilder.
Second method, you could also useToastScenario.IncomingCall
directly without adding the button.
Please try the following code:
builder.SetToastScenario(ToastScenario.IncomingCall);
Based on my test, after I used the above two methods, the toast notification will keep displaying until you click it.
Hope my solution could help you.
Best Regards,
Jack
If the answer is the right solution, please click "Accept Answer" and upvote it.If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.