Embed a live toast in your Windows 10 Universal App
There is a post "Embed a live tile in your Windows 10 app!" in MSDN blog. I will "extend it" to Preview Toast message in the app.
Similar to PreviewTile, you would have add following features in XAML.
And then ad following lines in your code:
//Construct a toast XML payload
var payload="<toast><visual><binding template="ToastText01"><text id="1">Hello</text></binding></visual></toast>";
//Initialize the previewToast contral
previewToast.Initialize(payload);
That's it!
Note: you need to installed the Anniversary Update of Windows 10 to get the latest NotificationsVisualizerLibrary package, otherwise you will experienced the smaller inline image screen issue in the preview message and even crush in the windows Phone app.
Similar to PreviewTile, you would have add following features in XAML.
<Pages:
xmlns:visualizer="using:NotificationsVisualizerLibrary"
... >
<library:PreviewToast
x:Name="PreviewToastDesktop"
ActivatedBackground="PreviewToastDesktop_ActivatedBackground"
ActivatedForeground="PreviewToastDesktop_ActivatedForeground"
ActivatedProtocol="PreviewToastDesktop_ActivatedProtocol"
ActivatedSystem="PreviewToastDesktop_ActivatedSystem"/>
And then ad following lines in your code:
//Construct a toast XML payload
var payload="<toast><visual><binding template="ToastText01"><text id="1">Hello</text></binding></visual></toast>";
//Initialize the previewToast contral
previewToast.Initialize(payload);
That's it!
Note: you need to installed the Anniversary Update of Windows 10 to get the latest NotificationsVisualizerLibrary package, otherwise you will experienced the smaller inline image screen issue in the preview message and even crush in the windows Phone app.
Comments
Post a Comment