protected override void HandleDataContextPathExtension(DataBindingProcessingContext context, RawDataSourceInfoBase bindingInfo)
        {
            string         valueAsString = DocumentPrimitiveNode.GetValueAsString(context.DocumentNode);
            PathChangeInfo pathChange    = this.GetPathChange(bindingInfo, valueAsString, false);

            if (pathChange == null)
            {
                return;
            }
            this.pathChanges.Add((PathChange) new SampleDataDocumentChangeProcessor.PrimitivePathChange(pathChange, context.ParentNode, context.Property));
        }
        private void HandleBindingOnChangePropertyAction(DataBindingProcessingContext context, RawDataSourceInfoBase bindingInfo)
        {
            string valueAsString = context.DocumentCompositeNode.GetValueAsString(SampleDataDocumentChangeProcessor.ChangePropertyActionNameProperty);

            if (string.IsNullOrEmpty(valueAsString))
            {
                return;
            }
            PathChangeInfo pathChange = this.GetPathChange(bindingInfo.SourceType, valueAsString, valueAsString, false);

            if (pathChange == null)
            {
                return;
            }
            this.pathChanges.Add((PathChange) new SampleDataDocumentChangeProcessor.ChangePropertyActionPathChange(pathChange, context.DocumentCompositeNode));
        }
 protected override void HandleBinding(DataBindingProcessingContext context, RawDataSourceInfoBase bindingInfo)
 {
     if (!bindingInfo.HasSource || !bindingInfo.IsValidClr)
     {
         return;
     }
     if (ProjectNeutralTypes.ChangePropertyAction.IsAssignableFrom((ITypeId)context.DocumentNode.Type))
     {
         this.HandleBindingOnChangePropertyAction(context, bindingInfo);
     }
     else
     {
         string         bindingPath          = DataContextHelper.GetBindingPath(context.DocumentCompositeNode);
         bool           preservePropertyName = this.ShouldPreservePropertyName(context);
         PathChangeInfo change = this.GetPathChange(bindingInfo, bindingPath, preservePropertyName);
         if (change == null)
         {
             return;
         }
         if (change.BreakingChange && context.Scope == ProcessingContextScope.DataTemplate && this.ProjectContext.IsCapabilitySet(PlatformCapability.IsWpf))
         {
             RawDataSourceInfoBase bindingInfo1 = this.ConvertDataTemplateContextToCollectionItem(context, bindingInfo);
             if (bindingInfo1 != null)
             {
                 PathChangeInfo pathChange = this.GetPathChange(bindingInfo1, bindingPath, preservePropertyName);
                 if (pathChange == null)
                 {
                     return;
                 }
                 if (!pathChange.BreakingChange)
                 {
                     change = pathChange;
                 }
             }
         }
         if (change == null)
         {
             return;
         }
         this.pathChanges.Add((PathChange) new SampleDataDocumentChangeProcessor.BindingPathChange(change, context.DocumentCompositeNode));
     }
 }
 public PrimitivePathChange(PathChangeInfo change, DocumentCompositeNode documentNode, IProperty pathProperty)
     : base(change, documentNode)
 {
     this.PathProperty = pathProperty;
 }
 public ChangePropertyActionPathChange(PathChangeInfo change, DocumentCompositeNode documentNode)
     : base(change, documentNode)
 {
 }
 public BindingPathChange(PathChangeInfo change, DocumentCompositeNode documentNode)
     : base(change, documentNode)
 {
 }
        private PathChangeInfo GetPathChange(IType sourceType, string normalizedClrPath, string clrPath, bool preservePropertyName)
        {
            if (string.IsNullOrEmpty(clrPath))
            {
                return((PathChangeInfo)null);
            }
            PathChangeInfo pathChangeInfo = new PathChangeInfo();

            pathChangeInfo.TargetType = sourceType;
            pathChangeInfo.OldPath    = clrPath;
            pathChangeInfo.NewPath    = string.Empty;
            IList <ClrPathPart> parts = ClrPropertyPathHelper.SplitPath(normalizedClrPath);

            if (parts == null)
            {
                return((PathChangeInfo)null);
            }
            bool flag = false;

            for (int index = 0; index < parts.Count; ++index)
            {
                ClrPathPart clrPathPart = parts[index];
                IType       targetType  = pathChangeInfo.TargetType;
                IType       type;
                if (clrPathPart.Category == ClrPathPartCategory.CurrentItem || clrPathPart.Category == ClrPathPartCategory.IndexStep)
                {
                    type = targetType.ItemType;
                }
                else
                {
                    IProperty property = this.VerifyPropertyName(clrPathPart.Path, targetType);
                    if (property == null)
                    {
                        type = (IType)null;
                    }
                    else
                    {
                        type = property.PropertyType;
                        if (property.Name != clrPathPart.Path)
                        {
                            flag = true;
                            clrPathPart.NewPath = property.Name;
                        }
                    }
                }
                pathChangeInfo.TargetType = type;
                if (type == null)
                {
                    pathChangeInfo.BreakingChange = true;
                    break;
                }
            }
            if (pathChangeInfo.BreakingChange)
            {
                return(pathChangeInfo);
            }
            if (!flag)
            {
                return((PathChangeInfo)null);
            }
            if (preservePropertyName)
            {
                string[] strArray      = ClrPropertyPathHelper.SplitAtFirstProperty(clrPath);
                string   inheritedPath = strArray[0];
                int      pathPartCount = ClrPropertyPathHelper.GetPathPartCount(strArray[1]);
                string   localPath     = ClrPropertyPathHelper.CombinePathParts(parts, parts.Count - pathPartCount);
                pathChangeInfo.NewPath = ClrPropertyPathHelper.CombinePaths(inheritedPath, localPath);
            }
            else
            {
                int pathPartCount = ClrPropertyPathHelper.GetPathPartCount(clrPath);
                pathChangeInfo.NewPath = ClrPropertyPathHelper.CombinePathParts(parts, parts.Count - pathPartCount);
            }
            return(pathChangeInfo);
        }