问题
How to get the ToastNotification working on Windows 10 IoT? (Raspberry Pi 2).
ToastBindingGeneric binding = new ToastBindingGeneric();
binding.Children.Add(new AdaptiveText() { Text = "Foo" });
binding.Children.Add(new AdaptiveText() { Text = "Trying to do something here hello!!!" });
ToastContent content = new ToastContent()
{
Visual = new ToastVisual()
{
BindingGeneric = binding
}
};
ToastNotificationManager.CreateToastNotifier().Show(new ToastNotification(content.GetXml()));
I'm using this code, it uses the Microsoft UWP Community Toolkit ( https://github.com/Microsoft/UWPCommunityToolkit ). For some reason it does not show a toast on the PI, but on Windows 10 desktop it does.
回答1:
Toast Notifications require a shell to function. However, currently, Windows IOTCore has no shell, so toast notifications are not supported. Similarly, file pickers, badge notifications, tiles and any other feature that requires a shell is not supported either.
来源:https://stackoverflow.com/questions/45839737/no-toastnotification-on-windows-10-iot-rpi2