![](/img/trans.png)
[英]How to access textbox control located in DataTemplate tags of <phone:PanoramaItem.HeaderTemplate> from code - behind (MainPage.xaml.cs)
[英]How to add back-code to an event of a datatemplate's control that is located in a separate xaml file (with no .cs file related)?
通常,当我构建UWP应用程序时,我将所有DataTemplate
样式都放在单独的“ Styles.xaml”文件中,通过合并它们,App.xaml中的常规ResourceDictionary
链接到该文件。
所有专业开发人员使用的标准方式。
但是,这一次,我需要向DataTemplate内部的xaml控件中的某个事件添加函数,但是我知道只有当DataTemplate
本身是内联定义的(即在ItemTemplate
属性中)时,该函数的方式。
那么,我如何向该事件添加一些后向代码?
-> 请注意,我已经知道将事件数据绑定到ViewModel中的函数,并且已经使用它了 ……这次我要谈论的是添加一些与代码无关(即包含在其中)的反向代码。 “模型”本身。
感谢您的关注。
最好的祝福。
您应该能够使用与WPF应用程序此处所述相同的方法将代码隐藏文件添加到XAML ResourceDictionary
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.