gpt4 book ai didi

windows-8 - Windows 8 广告显示在设置浮出控件之上

转载 作者:行者123 更新时间:2023-12-04 21:21:46 30 4
gpt4 key购买 nike

首先,截图:

ad from main view showing up on settings flyout

标题和图片很好地解释了它。我在我的应用程序主组 View 的右侧设置了一个广告(与本示例中的默认网格模板非常相似),当我拉起我的关于屏幕时,广告会渗出。

About 屏幕是 SettingsFlyout 上的用户控件集,我从开发营(下)分发的一些代码示例中借用了该控件。

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;
}
}

而且,因为我知道它会被要求,所以这是定义我页面上广告的 XAML 行:
<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"/>

那么,为什么会发生这种情况,我该如何预防呢?

疑点
  • 我还在 Consumer Preview b/c 上周一我有一个展示和讲述,没有时间在这个盒子上迁移操作系统,而在我展示这个时不会冒着无法正常工作的风险。因此,如果它是一个错误,升级可能会修复它。

    1.a. 更新 我已升级到 Release Preview 并遇到同样的问题。
  • 这里有一些花哨的广告隐藏但仍然获得印象的预防技术吗?也许它认为我正在尝试用 ui 元素覆盖广告,并且在用户没有看到它的情况下仍然获得它的印象。如果是这样,我如何管理这个完全合法的用例?

  • 剧透警报 : ZIndex 没有在任何地方设置。

    最佳答案

    覆盖 AppBar 时会出现同样的问题(上还是下)。我用了OpenedClosed AppBar 上的事件隐藏/显示广告的实例。这意味着 AdControl 绑定(bind)到本地页面属性,而不是直接绑定(bind)到 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's 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's not shown in the first place (not a trial)
    }

    关于windows-8 - Windows 8 广告显示在设置浮出控件之上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10973621/

    30 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com