Skip to content

Commit 7acb586

Browse files
committed
Update code sample
1 parent 3916d5a commit 7acb586

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Microsoft.Toolkit.Uwp.SampleApp/SamplePages/InAppNotification/InAppNotificationCode.bind

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,29 @@ if (isTemplatePresent && inAppNotificationWithButtonsTemplate is DataTemplate)
4646
ExampleInAppNotification.Show(inAppNotificationWithButtonsTemplate as DataTemplate);
4747
}
4848

49+
// Show notification using an object
50+
<controls:InAppNotification
51+
x:Name="ExampleInAppNotification"
52+
ContentTemplate="{StaticResource MyNotificationDataTemplate}" />
53+
54+
var notificationData = new MyNotificationData("Title", "Message");
55+
ExampleInAppNotification.Show(notificationData, duration: 2000);
56+
4957
// Dismiss notification
5058
ExampleInAppNotification.Dismiss();
5159

5260
// ## C# - Handle button events
5361

5462
private void YesButton_Click(object sender, RoutedEventArgs e)
5563
{
56-
// TODO : Do something when user accepted
64+
// TODO : Do something when user accepted
5765

5866
ExampleInAppNotification.Dismiss();
5967
}
6068

6169
private void NoButton_Click(object sender, RoutedEventArgs e)
6270
{
63-
// TODO : Do something when user refused
71+
// TODO : Do something when user refused
6472

6573
ExampleInAppNotification.Dismiss();
6674
}

0 commit comments

Comments
 (0)