/// <summary>
        /// Returns the data context of the specified <paramref name="obj"/>.
        /// </summary>
        /// <param name="obj">The target object to search the data context.</param>
        /// <param name="dataContext">The data context on object <paramref name="obj"/> or
        /// <c>null</c>, if no data context is present on the object.</param>
        /// <returns><c>true</c>, if a data context was found. In this case, the returned
        /// <paramref name="dataContext"/> is not-null. <c>false</c> else.</returns>
        /// <remarks>
        /// This method attaches change handlers to all relevant properties on the searched path.
        /// </remarks>
        protected bool GetDataContext(object obj, out BindingExtension dataContext)
        {
            DependencyObject current = obj as DependencyObject;

            if (current == null)
            {
                dataContext = null;
                return(false);
            }
            AbstractProperty dataContextProperty = current.DataContextProperty;

            AttachToSourcePathProperty(dataContextProperty);
            dataContext = dataContextProperty.GetValue() as BindingExtension;
            return(dataContext != null);
        }
        public override void DeepCopy(IDeepCopyable source, ICopyManager copyManager)
        {
            Detach();
            base.DeepCopy(source, copyManager);
            BindingExtension bme = (BindingExtension)source;

            Source         = copyManager.GetCopy(bme.Source);
            ElementName    = bme.ElementName;
            RelativeSource = bme.RelativeSource;
            CheckTypeOfSource();
            Path = bme.Path;
            Mode = bme.Mode;
            UpdateSourceTrigger = bme.UpdateSourceTrigger;
            Converter           = copyManager.GetCopy(bme.Converter);
            ConverterParameter  = copyManager.GetCopy(bme.ConverterParameter);

            _compiledPath = bme._compiledPath;
            Attach();
        }
Example #3
0
 protected CommandBaseMarkupExtension()
 {
     _source = new BindingExtension(this);
 }
 protected CommandBaseMarkupExtension()
 {
   _source = new BindingExtension(this);
 }
Example #5
0
 /// <summary>
 /// Returns the data context of the specified <paramref name="obj"/>.
 /// </summary>
 /// <param name="obj">The target object to search the data context.</param>
 /// <param name="dataContext">The data context on object <paramref name="obj"/> or
 /// <c>null</c>, if no data context is present on the object.</param>
 /// <returns><c>true</c>, if a data context was found. In this case, the returned
 /// <paramref name="dataContext"/> is not-null. <c>false</c> else.</returns>
 /// <remarks>
 /// This method attaches change handlers to all relevant properties on the searched path.
 /// </remarks>
 protected bool GetDataContext(object obj, out BindingExtension dataContext)
 {
   DependencyObject current = obj as DependencyObject;
   if (current == null)
   {
     dataContext = null;
     return false;
   }
   AbstractProperty dataContextProperty = current.DataContextProperty;
   AttachToSourcePathProperty(dataContextProperty);
   dataContext = dataContextProperty.GetValue() as BindingExtension;
   return dataContext != null;
 }