Search Wiki:
Resource Page Description
An Ad Rotator control in Silverlight 2 that uses the AdRotator XML format http://schemas.microsoft.com/AspNet/AdRotator-Advertisement-File-1.2. This can use use ads in JPEG, PNG, WMV, or Xaml format. All standard ad formats are supported.

Summary

This is a Silverlight-based Ad Rotator that uses the same XML format as the ASP.net AdRotator class. In addition to image formats you can also specify WMV and XAML ads.

What this Code Demonstrates

  • A custom control that can be skinned and styles
  • Design-time view and Expression Blend extensibility (Section & Property Description)
Ad Rotator in Expression Blend Ad Rotator in Expression Blend Properties Pane

Sample Usage

<UserControl x:Class="Silverlight_Test.Page"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:ar="clr-namespace:Synergist;assembly=AdRotatorLibrary"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    >
    <Grid x:Name="LayoutRoot" Background="Azure">
        <StackPanel>
            <TextBlock Text="Ad Rotator" Margin="5" HorizontalAlignment="Center" FontWeight="Bold"/>
                <ar:AdRotator Format="Button" Source="../Advertisements.xml"/>
            </StackPanel>
    </Grid>
</UserControl>

Sample AdRotator XML

<?xml version="1.0" encoding="utf-8" ?>
<Advertisements xmlns="http://schemas.microsoft.com/AspNet/AdRotator-Advertisement-File-1.2">
  <Ad xmlns="">
    <ImageUrl>Ads/ballwatch.png</ImageUrl>
    <Height>100</Height>
    <Width>100</Width>
    <NavigateUrl>http://xmldocs.net/ball</NavigateUrl>
    <AlternateText>Ball Watch Company's Trainmaster Cannonball in Silverlight</AlternateText>
    <Keyword>Silverlight</Keyword>
    <Impressions>1</Impressions>
  </Ad>
  <Ad xmlns="">
    <ImageUrl>Ads/bear.wmv</ImageUrl>
    <AlternateText>Bear Video</AlternateText>
    <Impressions>1</Impressions>
  </Ad>
  <Ad xmlns="">
    <ImageUrl>Ads/XamlAd.xaml</ImageUrl>
    <AlternateText>Xaml Ad</AlternateText>
    <Impressions>1</Impressions>
    <NavigateUrl>http://blogs.msdn.com/synergist</NavigateUrl>
  </Ad> 
</Advertisements>
Last edited Feb 5 2009 at 4:23 AM  by mscherotter, version 3
Updating...
Page view tracker