2014-10-20 77 views
1

当我用诡异的问题抨击我的头时,来自微软pubcenter的广告不是clickabkle,当 应用程序使用D3D/XAML互操作。 但是我看到很多带有pubcenter ads的windows商店游戏,并明确使用d3d/xaml - 如何让这两个人一起工作?Pubcenter广告不可点击

简单的步骤来重现问题: (VS2013 - 所有最新的更新,pibcenter CTRL也更新到最新版本)

VS2013 - >新建 - >项目 - >(的Visual C++/Store的应用程式) - > DirectX和XAML应用程序(Windows phone)系统

(注:这是由于Windows手机应用程序8.1,的Windows Phone 8.1的Silverlight应用程序)

创建项目时,只是去DirectXPage.xaml

和编辑它看起来如下:

<Page 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:local="using:AdTest" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:UI="using:Microsoft.Advertising.Mobile.UI" 
    x:Class="AdTest.DirectXPage" 
    mc:Ignorable="d"> 

    <SwapChainPanel x:Name="swapChainPanel"> 

     <!-- Grid definition, to place ad on bottom (may remove if no ads) --> 
     <Grid.RowDefinitions> 
      <RowDefinition Height="*"/> 
      <RowDefinition Height="50"/> 
     </Grid.RowDefinitions> 

     <Grid.ColumnDefinitions> 
      <ColumnDefinition Width="*"/> 
     </Grid.ColumnDefinitions> 

     <TextBlock Text="Hello from XAML!" 
HorizontalAlignment="Right" 
VerticalAlignment="Top" 
FontSize="30" /> 

     <UI:AdControl Grid.Column="0" Grid.Row="1" x:Name="adBanner" AutoRefreshIntervalInSeconds="60" ApplicationId="xxxxxxxxxxx" AdUnitId="xxxxx" HorizontalAlignment="Right" Height="50" IsAutoRefreshEnabled="True" Margin="0,0,0,0" VerticalAlignment="Bottom" Width="320"/> 

    </SwapChainPanel> 

    <!-- Uncomment this if using the app bar in your phone application. 
    <Page.BottomAppBar> 
     <CommandBar> 
      <AppBarButton Icon="Play" AutomationProperties.Name="Sample Button" 
          AutomationProperties.AutomationId="SampleAppBarButton" Click="AppBarButton_Click" /> 
     </CommandBar> 
    </Page.BottomAppBar>--> 
</Page> 

与真正的应用程序/单元编号代替XXXXX和运行示例 - 现在当旗帜显示,请尝试点击它 - 它不工作:/ 有什么办法让它可以点击吗? (它没有被任何其他控件覆盖,它得到了正确的输入,所以我不知道问题可能是什么)。

+0

试着在'SwapChainPanel'后面加上'AdControl'。 – Kulasangar 2014-10-21 01:37:32

+0

nope,这是行不通的,如果我删除TextBlock(所以AdControl是SwapChainPanel中唯一的一个,它仍然是不可点击的) - 你试过了吗,它对你有用吗? – user2441788 2014-10-21 08:56:47

回答

0

你解决了你的问题吗?这似乎与它是一个C++应用程序有关,我也遇到了很多问题。 一个解决办法,我发现是广告挖掘到的控制方法:

adPubcenter->Tapped += ref new Windows::UI::Xaml::Input::TappedEventHandler(this, &OpenGLESPage::OnAdTapped); 


void OpenGLESPage::OnAdTapped(Platform::Object^ sender, Windows::UI::Xaml::Input::TappedRoutedEventArgs^ e){ 

然后

void OpenGLESPage::OnAdTapped(Platform::Object^ sender, Windows::UI::Xaml::Input::TappedRoutedEventArgs^ e){ 
    //Handle touch yourself (ie. opens a game that you have) 
    Windows::System::Launcher::LaunchUriAsync(ref new Uri("http://www.windowsphone.com/s?appid=bb8d4ce2-1853-47b6-9b0d-bb1af5a07436")); 
} 

至少这样点击广告时做一些事情。