Ad resizing in new Windows 10 SDK Release

We’ve just released an important update to our Windows 10 SDK (version 10.0.1.1). Among other minor fixes and improvements It includes one important bug fix and one important new feature. Let’s cover the bug fix first.

Incorrect default ad size

Unfortunately some basic math error has slipped through unnoticed in earlier versions of the Windows 10 SDK and ads defaulted to the 320×50 effective pixel size, which is slightly incorrect aspect ration compared to the actual size of the images you upload (768×128). Sorry about that! We have now fixed the control to default to the correct size of 300×50.

Having said that, we made sure that we don’t break anything for those who had 320×50 hardcoded. In this scenario you will see some letterboxing around the ad, but the aspect ratio of the banners will be correct 6:1.

image

Resizable ads

While many of you enjoyed ads being quite small, some reported that this small size looks out of place in their designs on the desktop when the app window is relatively large. So, on a more positive note, we’ve added support for resizing of the ad control, as long as the correct aspect ratio of 6:1 is upheld and the size is at least 300×50 pixels. Like in an example you see below.

resizing-640

You can implement this type of resizing using adaptive triggers or other technique. The sample above sets the ad size to 480×80 and then flips the size to 300×50 when window gets narrow with code like this:


<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="VisualStateGroup">
<VisualState x:Name="VisualStateNarrow">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="{StaticResource NarrowMinWidth}" />
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="AdDuplexControl.Width" Value="300" />
<Setter Target="AdDuplexControl.Height" Value="50" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="VisualStateNormal">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="{StaticResource NormalMinWidth}" />
</VisualState.StateTriggers>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>

As usual you can upgrade to the newest version from the Visual Studio gallery.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s