xaml - UWP:如何将视图传递给 InAppNotifications 控件?
问题描述
我正在使用 Windows Community Sample Toolkit 中的 InAppNotifications 控件。我有一个名为 "DemoFile.xaml" 的单独用户控件。这个 Demo 文件有我想在 InAppNotification 控件中显示的内容。
演示文件.xaml
<UserControl>
<TextBox Text = "Text"/>
</UserControl>
我的 InAppNotifications 控件看起来像这样
通知.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);
}
推荐阅读
- amazon-web-services - 如何使用 AWS CLI 更新弹性 beanstalk 代码?
- asp.net - Net Core 2.0 寻找 appsettings.Production.json
- python - Keras模型层输入大小不匹配错误
- javascript - 识别网页中的内部标签
- tfs - TF400856:以下服务未在数据库中注册:IdentityManagement
- pandas - 每组 4 个日历月的 Pandas 找到最大值出现的日期
- c# - 如何添加数据网格视图并将其显示在数据网格视图中
- android - react-native - 在 CSS StyleSheet 中添加公式会影响性能吗?
- haskell - 部分同时执行的操作列表
- python - 如何在使用熊猫导入 csv 时跳过前几行文本?