title: AdDuplex Ad Control keeps showing despite collapsing it
body: <p>I’m creating a WinRT (Windows 8.1 and Windows Phone 8.1) app in which I placed an AdDuplex ad control in one of its pages.</p>
  
  <p>The user of the app can choose to remove the ad (with an IAP). When they do, I set the <code>Visibility</code> of the AdDuplex ad control  to <code>Collapsed</code>, from the page ViewModel.</p>
  
  <p>This part works fine; however, after some time, <strong>while the user is still on the page</strong>, AdDuplex ad control suddenly becomes visible again and starts showing ads.</p>
  
  <p>At the beginning, I thought this is the behavior of IAP when using <code>CurrentAppSimulator</code>, although it didn’t make sense to me, since I have nothing in the code that reacts to license changes and hence setting the control back to <code>Visible</code>. Yet, I tested <code>license.IsActive</code> for my " NoAd” product and got <code>true</code>, indicating that the license is valid.</p>
  
  <p>The following is a simplified part of my code:</p>
  
  <p><strong>MyPage.xaml</strong></p>
  
  <pre><code>&lt;ad:AdControl
      AdUnitId="{StaticResource AdUnitId}"
      AppKey="{StaticResource AdAppKey}"
      IsTest="True"
      CollapseOnError="True"
      Visibility="{Binding IsNoAdPurchased, Converter={StaticResource BooleanToVisibilityInvertedConverter}}"/&gt;
  </code></pre>
  
  <p><strong>MyPageViewModel.cs</strong></p>
  
  <pre><code>private async void RemoveAd()
  {
      this.IsNoAdPurchased = await this.storeService.PurchaseProductAsync(Products.NoAd);
  }
  </code></pre>
  
  <p><strong>StoreService.cs</strong></p>
  
  <pre><code>#if DEBUG
  using StoreCurrentApp = Windows.ApplicationModel.Store.CurrentAppSimulator;
  #else
  using StoreCurrentApp = Windows.ApplicationModel.Store.CurrentApp;
  #endif
  
  public sealed class StoreService
  {
      public async Task&lt;bool&gt; PurchaseProductAsync(string productId)
      {
          try
          {
              var purchase = await StoreCurrentApp.RequestProductPurchaseAsync(productId);
              return purchase.Status == ProductPurchaseStatus.Succeeded || purchase.Status == ProductPurchaseStatus.AlreadyPurchased;
          }
          catch (Exception)
          {
              // The purchase did not complete because an error occurred.
              return false;
          }
      }
  }
  </code></pre>