UWP:如何将视图传递给 InAppNotifications 控件?

UWP: How to pass a view to the InAppNotifications control?

我正在使用 Windows 社区示例工具包中的 InAppNotifications 控件。我有一个名为 "DemoFile.xaml" 的单独用户控件。这个Demo文件有我想在InAppNotification控件中显示的内容。

DemoFile.xaml

<UserControl>
    <TextBox Text = "Text"/>
  </UserControl>

我的 InAppNotifications 控件如下所示

Notifications.xaml

<UserControl>
   <Grid>
      <tk_ctl:InAppNotification
        x:Name="Notification"
        ShowDismissButton="True"
        StackMode="Replace"/>
</Grid>

这个 Notifications.xaml.cs

背后的代码
public class Notifications : UserControl
{
   this.Notification.Show();  // want to pass the Demo File here 
}

如何将演示文件作为参数传递给 Show?

InAppNotification支持显示通知内容为UIElement。你可以像下面这样写。

private void Button_Click(object sender, RoutedEventArgs e)
        { 
            var usercontrol = new DemoFile ();
Notification.Show(usercontrol);
        }