Skip to content

Instantly share code, notes, and snippets.

@dbeattie71
Created February 27, 2012 23:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dbeattie71/1927879 to your computer and use it in GitHub Desktop.
Save dbeattie71/1927879 to your computer and use it in GitHub Desktop.
AdControlEx
using System.Windows;
using Microsoft.Advertising.Mobile.UI;
namespace Gmp.App.Framework.Controls
{
public class AdControlEx : AdControl
{
//MyApplicaitonId
public const string MyApplicationIdPropertyName = "MyApplicationId";
public string MyApplicationId
{
get { return (string) GetValue(MyApplicationIdProperty); }
set { SetValue(MyApplicationIdProperty, value); }
}
public static readonly DependencyProperty MyApplicationIdProperty = DependencyProperty.Register(
MyApplicationIdPropertyName,
typeof (string),
typeof (AdControl),
new PropertyMetadata("", OnMyApplicationIdPropertyChanged));
private static void OnMyApplicationIdPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
((AdControl) d).ApplicationId = e.NewValue as string;
}
//MyAdUnitId
public const string MyAdUnitIdPropertyName = "MyAdUnitId";
public string MyAdUnitId
{
get { return (string) GetValue(MyAdUnitIdProperty); }
set { SetValue(MyAdUnitIdProperty, value); }
}
public static readonly DependencyProperty MyAdUnitIdProperty = DependencyProperty.Register(
MyAdUnitIdPropertyName,
typeof (string),
typeof (AdControl),
new PropertyMetadata("", OnMyAdUnitIdPropertyChanged));
private static void OnMyAdUnitIdPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
((AdControl) d).AdUnitId = e.NewValue as string;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment