Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class AdViewRenderer : ViewRenderer<AdControlView, UWPAdView>
- {
- protected override void OnElementChanged(ElementChangedEventArgs<AdControlView> e)
- {
- base.OnElementChanged(e);
- if (null == Control && e.NewElement != null)
- {
- UWPAdView ad = new UWPAdView();
- SetNativeControl(ad);
- }
- }
- }
- <UserControl
- x:Class="Sample.UWP.Helpers.UWPAdView"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:aduwp="using:Microsoft.Advertising.WinRT.UI"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- d:DesignHeight="300"
- d:DesignWidth="400"
- mc:Ignorable="d">
- <Grid>
- <aduwp:AdControl
- Width="640"
- Height="100"
- HorizontalAlignment="Stretch"
- AdUnitId="myadunitid"
- ApplicationId="myappid"
- AutoRefreshIntervalInSeconds="30"
- ErrorOccurred="AdControl_ErrorOccurred"
- IsAutoRefreshEnabled="True" />
- </Grid>
- </UserControl>
Add Comment
Please, Sign In to add comment