예제 #1
0
		void SetDataContextSource (FrameworkElement fe)
		{
			if (DataContextSource != null)
				DataContextSource.RemovePropertyChangedHandler (FrameworkElement.DataContextProperty, DataContextChanged);
			DataContextSource = fe;
			if (DataContextSource != null)
				DataContextSource.AddPropertyChangedHandler (FrameworkElement.DataContextProperty, DataContextChanged);

			// If a FrameworkElement binds to its own datacontext and the VisualParent is null, we end
			// up here with a null DataContextSource. In this scenario we do not want to update.
			if (DataContextSource != null || IsMentorDataContextBound)
				PropertyPathWalker.Update (DataContextSource == null ? null : DataContextSource.DataContext);
		}
예제 #2
0
		void AttachDataContextHandlers (FrameworkElement mentor)
		{
			if (mentor != null)
				mentor.AddPropertyChangedHandler (FrameworkElement.DataContextProperty, OnNativeMentorDataContextChangedSafe);
		}