protected override void OnSourceChanged (object oldSource, object newSource)
		{
			base.OnSourceChanged (oldSource, newSource);

			var old_do = oldSource as DependencyObject;
			var new_do = newSource as DependencyObject;
			if (Listener != null) {
				Listener.Detach ();
			}

			DependencyProperty = null;
			PropertyInfo = null;
			if (Source == null)
				return;

			var type = Source.GetType ();
			if (TypeName != null)
				type = Application.GetComponentTypeFromName (TypeName);

			if (type == null)
				return;

			DependencyProperty prop;
			Types.Ensure (type);
			if (new_do != null && DependencyProperty.TryLookup (Deployment.Current.Types.TypeToKind (type), PropertyName, out prop)) {
				DependencyProperty = prop;
				Listener = new WeakPropertyChangedListener (new_do, DependencyProperty, this);
			}

			// If there's an attached DP called 'Foo' and also a regular CLR property
			// called 'Foo', we cannot use the property info from the CLR property.
			// Otherwise if the CLR property declares a type converter, we could
			// inadvertantly use it when we should not.
			if (DependencyProperty == null || !DependencyProperty.IsAttached) {
				PropertyInfo = type.GetProperty (PropertyName);
			}
		}
		internal override void OnAttached (DependencyObject element)
		{
			base.OnAttached (element);

			Target = (FrameworkElement) element;
			if (Listener != null) {
				Listener.Detach ();
				Listener = null;
			}

			ContentControl c = Target as ContentControl;
			if (TargetProperty == ContentControl.ContentProperty && c != null) {
				SetsParent = c.ContentSetsParent;
				c.ContentSetsParent = false;
			}

			// Note that Target.TemplateOwner is a weak reference - it can be GC'ed at any time
			var source = Target.TemplateOwner;
			if (source != null)
				Listener = new WeakPropertyChangedListener (source, SourceProperty, this);
		}