简体   繁体   中英

Toast Reminder on C# Windows 10 Desktop App Not Persisting?

I've been trying to use the 'reminder' value for the scenario attribute on a toast in a Windows 10 desktop application, and cannot get the toast to persist on the desktop.

Using the desktop toast sample on github, I've tried to add the attribute and value to the toastXml (around line 116) with the following:

        IXmlNode toastBase = toastXml.SelectSingleNode("toast");
        XmlAttribute scenarioAttrib = toastXml.CreateAttribute("scenario");
        scenarioAttrib.Value = "reminder";
        toastBase.Attributes.SetNamedItem(scenarioAttrib);

This seems to be working as intended, as writing the toastXml out to a string gives me:

        <toast scenario="reminder"><visual><binding template="ToastImageAndText04"><image id="1" src="file:///X:/Users/.../Desktop/CS/bin/Debug/toastImageAndText.png"/><text id="1">Line 0</text><text id="2">Line 1</text><text id="3">Line 2</text></binding></visual></toast>

But, after the 7 second or so timeout, the toast on the desktop disappears and is placed in the action center.

Is there a trick I'm missing to get this to work?

I know this request is ancient, but you need an "action" to make Windows treat a reminder as a reminder.

https://docs.microsoft.com/en-us/windows/uwp/design/shell/tiles-and-notifications/adaptive-interactive-toasts#alarms-reminders-and-incoming-calls

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM