Guest User

Untitled

a guest
Apr 26th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. public class AdViewRenderer : ViewRenderer<AdControlView, UWPAdView>
  2. {
  3. protected override void OnElementChanged(ElementChangedEventArgs<AdControlView> e)
  4. {
  5. base.OnElementChanged(e);
  6.  
  7. if (null == Control && e.NewElement != null)
  8. {
  9. UWPAdView ad = new UWPAdView();
  10. SetNativeControl(ad);
  11. }
  12. }
  13. }
  14.  
  15. <UserControl
  16. x:Class="Sample.UWP.Helpers.UWPAdView"
  17. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  18. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  19. xmlns:aduwp="using:Microsoft.Advertising.WinRT.UI"
  20. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  21. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  22. d:DesignHeight="300"
  23. d:DesignWidth="400"
  24. mc:Ignorable="d">
  25.  
  26. <Grid>
  27. <aduwp:AdControl
  28. Width="640"
  29. Height="100"
  30. HorizontalAlignment="Stretch"
  31. AdUnitId="myadunitid"
  32. ApplicationId="myappid"
  33. AutoRefreshIntervalInSeconds="30"
  34. ErrorOccurred="AdControl_ErrorOccurred"
  35. IsAutoRefreshEnabled="True" />
  36. </Grid>
  37. </UserControl>
Add Comment
Please, Sign In to add comment