我有一个 C# XAML Windows 8 项目。
HubPage.xaml 包含一个GridView名为HubGridView。HubGridView使用一个ItemTemplateSelector名为HubItemTemplateSelector的自定义。HubItemTemplateSelector选择在名为HubResourceDictionary.xaml的文件中定义的命名AdDataTemplate。AdDataTemplate包含一个名为HubAdControl的元素。DataTemplateResourceDictionaryAdControl
我需要能够将HubAdControlsErrorOccurred事件处理程序设置为在某处的代码隐藏中定义的方法。我该如何做到这一点?
HubPage.xaml:
<GridView x:Name="HubGridView" ItemTemplateSelector="{StaticResource HubItemTemplateSelector}" />
HubResourceDictionary.xaml:
<DataTemplate x:Key="AdDataTemplate">
<Grid>
<UI:AdControl x:Name="HubAdControl" />
</Grid>
</DataTemplate>