Windows 8 ads appear at the top of the settings pop-ups

First screenshot:

ad from main view showing up on settings flyout

The name and image explain it pretty well. I have an ad set to the right of the main group view of my application (very similar to the default grid template in this example), and when I pull the "About" screen, the ad expires through.

The About screen is a set of user controls that I borrowed from some code samples that were passed to dev-camp (below).

class SettingsFlyout
{
    private const int _width = 346;
    private Popup _popup;

    public void ShowFlyout(UserControl control)
    {
        _popup = new Popup();
        _popup.Closed += OnPopupClosed;
        Window.Current.Activated += OnWindowActivated;
        _popup.IsLightDismissEnabled = true;
        _popup.Width = _width;
        _popup.Height = Window.Current.Bounds.Height;

        control.Width = _width;
        control.Height = Window.Current.Bounds.Height;

        _popup.Child = control;
        _popup.SetValue(Canvas.LeftProperty, Window.Current.Bounds.Width - _width);
        _popup.SetValue(Canvas.TopProperty, 0);
        _popup.IsOpen = true;
    }

    private void OnWindowActivated(object sender, Windows.UI.Core.WindowActivatedEventArgs e)
    {
        if (e.WindowActivationState == Windows.UI.Core.CoreWindowActivationState.Deactivated)
        {
            _popup.IsOpen = false;
        }
    }

    void OnPopupClosed(object sender, object e)
    {
        Window.Current.Activated -= OnWindowActivated;
    }
}

And, since I know this will be suggested, here is the XAML line defining the ad on my page:

<ads:AdControl Visibility="{Binding IsTrial, Source={StaticResource License}, Converter={StaticResource BooleanToVisibilityConverter}}"  Grid.Row="0" Grid.RowSpan="2" x:Name="LandscapeAdControl" ApplicationId="test_client" AdUnitId="Image_160x600" Width="160" Height="600" VerticalAlignment="Center" HorizontalAlignment="Right"/>

So why is this happening, and how can I prevent it?

Suspicions

  • Consumer Preview b/c. -- , , , , , .

    1.. . .

  • - , ? , , ui , . , ?

: ZIndex .

+5
5

, , / . , , .

+1

AppBar ( ). Opened Closed AppBar, / . , AdControl ViewModel. , , .

    private void bottomAppBar_Opened(object sender, object e)
    {
        if (App.ViewModel.IsTrialVisibility == Visibility.Visible)
            this.DefaultViewModel["AdVisibility"] = Visibility.Collapsed;
        // else do nothing as we don't want to show it since it not a trial
    }

    private void bottomAppBar_Closed(object sender, object e)
    {
        if(App.ViewModel.IsTrialVisibility == Visibility.Visible)
            this.DefaultViewModel["AdVisibility"] = Visibility.Visible;
        // else do nothing as it not shown in the first place (not a trial)
    }
+2

AdControl : UseStaticAnchor

true , AdControl .

- :

AdControl : Suspend() Resume(). , AppBar, Suspend() Resume(), .

, AdControl WebView . - , WebView . - WebView, a WebViewBrush. ( : http://msdn.microsoft.com/library/windows/apps/windows.ui.xaml.controls.webviewbrush) , Suspend() Resume(), AdControl .

, , - UserControl ( SuspendingAdControl), AdControl . , , Caliburn Micro EventAggregator . SuspendingAdControl , AdControl.Suspend() Resume().

+2

, 8.1 Z-.

0

Consumer Preview b/c. -- , . , , .

I have not used advertisements in my applications for the metro yet, so I have not seen such problems as this happens. I use the Preview Release, and I used the preview until May 2.

There have been some significant changes between the preview and the release of the preview. Thus, an update may fix this or may break something else.

In the end you will have to upgrade. I suggest trying this before you try to solve the problem.

-3
source

All Articles