コード例 #1
0
        protected override IPropertyId GetDefaultPropertySelection()
        {
            Type           type      = this.BindingPath.Node.Type;
            IType          dataType  = (IType)null;
            SceneViewModel viewModel = this.TargetElement.ViewModel;

            if (type != (Type)null)
            {
                dataType = viewModel.ProjectContext.GetType(type);
            }
            if (dataType == null)
            {
                dataType = viewModel.ProjectContext.ResolveType(PlatformTypes.Object);
            }
            IProperty property = BindingPropertyHelper.GetDefaultBindingPropertyInfo(this.TargetElement, dataType).Property;

            if (this.targetBindableProperties.IndexOf((ReferenceStep)property) < 0)
            {
                property = (IProperty)null;
            }
            if (property == null && dataType != null)
            {
                foreach (ReferenceStep referenceStep in (IEnumerable <ReferenceStep>) this.targetBindableProperties)
                {
                    if (BindingPropertyHelper.GetPropertyCompatibility((IProperty)referenceStep, dataType, (ITypeResolver)this.ViewModel.ProjectContext) != BindingPropertyCompatibility.None)
                    {
                        property = (IProperty)referenceStep;
                        break;
                    }
                }
            }
            return((IPropertyId)property);
        }
コード例 #2
0
        protected override IPropertyId GetDefaultPropertySelection()
        {
            BindingPropertyMatchInfo bindingPropertyInfo = BindingPropertyHelper.GetDefaultBindingPropertyInfo(this.TargetElement, this.targetPropertyType);

            if (bindingPropertyInfo.Compatibility != BindingPropertyCompatibility.None)
            {
                ReferenceStep referenceStep = (ReferenceStep)bindingPropertyInfo.Property;
                if (this.sourceBindingProperties.Contains(referenceStep))
                {
                    return((IPropertyId)referenceStep);
                }
            }
            foreach (ReferenceStep referenceStep in (IEnumerable <ReferenceStep>) this.sourceBindingProperties)
            {
                if (this.targetPropertyType != null && this.targetPropertyType.IsAssignableFrom((ITypeId)referenceStep.PropertyType))
                {
                    return((IPropertyId)referenceStep);
                }
            }
            return((IPropertyId)null);
        }