Click here to Skip to main content
Click here to Skip to main content

Tagged as

Clean up your margins when using the Windows Phone 7 AD SDK

, 20 Mar 2011 CPOL
Rate this:
Please Sign up or sign in to vote.
This article will show you a tip/trick to help your ad display properly.
One thing that I’ve noticed in several apps in the Windows Phone 7 marketplace is the ad chopping off on the right hand side. I decided that my next Windows Phone 7 app will be ad supported so why not sign up for the Advertising SDK and investigate this issue. *Note: If you want to see this in an actual app, then download the free app called “Road Rage”.
 
So here is an example of what I am talking about:
Image 1
 
You will notice that the right hand side of the AD is chopped off using the default ad banner. You can see the border on the left hand side clearly. So, what exactly is going on? Let’s take a look at this in the designer.
Image 2
 
From this image we can see it clearer, the margin of the grid that the ad is contained in needs to be removed.
 
By default, the ContentPanel in a Windows Phone Page has a margin already set on it. See below for an example of this:
<grid x:name="ContentPanel" grid.row="1" margin="12,0,12,0" xmlns:x="#unknown" />
 
If you simply remove that margin, then your ad will display properly as shown below.
Image 3
 
It’s strange that I’ve seen this in multiple WP7 applications in the marketplace. If you are trying to make money off Ads, you would probably want to make sure the full ad is displayed. I am hoping this short post helped someone.
 
Subscribe to my feedburner feed or follow me on twitter.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

mbcrump
Software Developer (Senior) Telerik
United States United States
Michael Crump is a Silverlight MVP and MCPD that has been involved with computers in one way or another for as long as he can remember, but started professionally in 2002. After spending years working as a systems administrator/tech support analyst, Michael branched out and started developing internal utilities that automated repetitive tasks and freed up full-time employees. From there, he was offered a job working at McKesson corporation and has been working with some form of .NET and VB/C# since 2003.
 
He has worked at Fortune 500 companies where he gained experience in embedded systems design and software development to systems administration and database programming, and everything in between.
 
His primary focus right now is developing healthcare software solutions using Microsoft .NET technologies. He prefers building infrastructure components, reusable shared libraries and helping companies define, develop and automate process standards and guidelines.
 
You can read his blog at: MichaelCrump.net or follow him on Twitter at @mbcrump.
Follow on   Twitter

Comments and Discussions

 
GeneralReason for my vote of 5 Excellent article and very practical... PinmemberDrABELL21-Mar-11 7:12 
Reason for my vote of 5
Excellent article and very practical solution, 5*!
 
My only recommendation is to use the <img src=> tag for Images rather that href, so Images will be displayed inline for better readability (see my Tips as an example: http://www.codeproject.com/Tips/170049/MODAL-DIALOG-BOX-IMPLEMENTED-AS-PURE-HTML5-CSS3-SO.aspx).
 
Kind regards, Alex

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.1411023.1 | Last Updated 20 Mar 2011
Article Copyright 2011 by mbcrump
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid