Search code examples
c#windowsxamlwindows-phone-8windows-phone-8.1

How to place ads in a fixed position in WP8.1 c#


I am trying to make my app to look more professional but I am having a little problem am trying to make my ad position to stick on top of the application bar like in 1st4fans manchester united edition enter image description here, I have tried to add the admediator in my app but if the screen size is changed it changes position.

here is the code i added

  <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True" Mode="Default"  >
            <shell:ApplicationBar.MenuItems>

            </shell:ApplicationBar.MenuItems>
            <shell:ApplicationBarIconButton x:Name="Refresh" IconUri="/Assets/AppBar/refresh.png" IsEnabled="True" Text="Refresh" Click="Refresh_Click"/>
            <shell:ApplicationBarIconButton x:Name="Deals" IconUri="Assets/AppBar/appbar.dollar.png" IsEnabled="True" Text="Deals" Click="Deals_Click"/>
            <shell:ApplicationBarIconButton x:Name="Share" IconUri="/Assets/AppBar/share.png" IsEnabled="True" Text="Share" Click="Share_Click"/>

        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>

<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="RLayoutRoot">
    <phone:WebBrowser x:Name="WebView" LoadCompleted="WebView_LoadCompleted" />
    <WindowsPhone8:AdMediatorControl x:Name="AdMediator_E63AA5" HorizontalAlignment="Left" Height="80" Id="AdMediator-Id-88DF6148-5162-486A-B897-11473F4AB2F9" Margin="-10,616,0,0" VerticalAlignment="Top" Width="480"/>
    <ProgressBar x:Name="ReadProgress"  HorizontalAlignment="Left" Height="60" VerticalAlignment="Top" Width="480" Margin="10,325,-10,0"/>
</Grid>


Solution

  • Get rid of your "absolute" layout using margins and just align it to bottom.