Example #1
0
        public static PropertyReference ResolvePropertyPath(ITypeResolver typeResolver, IViewObject propertyPath, SceneNode pathRoot)
        {
            if (propertyPath == null)
            {
                return((PropertyReference)null);
            }
            string path = (string)propertyPath.GetCurrentValue(typeResolver.ResolveProperty(typeResolver.PlatformMetadata.KnownProperties.PropertyPathPath));

            if (path == null)
            {
                return((PropertyReference)null);
            }
            IProperty           propertyKey = typeResolver.ResolveProperty(typeResolver.PlatformMetadata.KnownProperties.PropertyPathPathParameters);
            Collection <object> parameters  = propertyKey == null ? new Collection <object>() : (Collection <object>)propertyPath.GetCurrentValue(propertyKey);

            return(TimelineSceneNode.ResolvePropertyPathParts(typeResolver, path, parameters, pathRoot));
        }
 public static bool GetUseLayoutRounding(SceneElement element)
 {
     if (element != null && element.Type != null)
     {
         IProperty propertyKey = LayoutRoundingHelper.ResolveUseLayoutRoundingProperty((SceneNode)element);
         if (propertyKey != null)
         {
             if (propertyKey.DeclaringType.IsAssignableFrom((ITypeId)element.Type))
             {
                 return((bool)element.GetComputedValue((IPropertyId)propertyKey));
             }
             FrameworkTemplateElement frameworkTemplateElement = element as FrameworkTemplateElement;
             if (frameworkTemplateElement != null)
             {
                 IViewObject viewTargetElement = frameworkTemplateElement.ViewTargetElement;
                 if (viewTargetElement != null && propertyKey.DeclaringType.IsAssignableFrom((ITypeId)viewTargetElement.GetIType((ITypeResolver)element.ProjectContext)))
                 {
                     return((bool)viewTargetElement.GetCurrentValue(propertyKey));
                 }
             }
         }
     }
     return(false);
 }
Example #3
0
        private static ModelItem GetModelItemForObject(IPlatform platform, object obj)
        {
            IViewObject viewObject = platform.ViewObjectFactory.Instantiate(obj);
            IDesignModeValueProviderContext valueProviderContext = WeakReferenceHelper.Unwrap <IInstanceBuilderContext>(viewObject.GetCurrentValue(platform.Metadata.ResolveProperty(DesignTimeProperties.InstanceBuilderContextProperty))) as IDesignModeValueProviderContext;

            if (valueProviderContext != null)
            {
                return(valueProviderContext.GetModelItemForViewObject(viewObject));
            }
            return((ModelItem)null);
        }
Example #4
0
 protected override object GetComputedValueInternal(PropertyReference propertyReference)
 {
     if (this.IsTextRangeProperty(propertyReference))
     {
         if (!this.ShouldForwardPropertyChangeToControl(propertyReference))
         {
             PropertyReference propertyReference1 = this.ConvertToPlatformPropertyReference(propertyReference);
             object            textValue          = this.GetTextValue(this.TextRange, propertyReference1);
             object            obj = textValue;
             if (textValue != MixedProperty.Mixed)
             {
                 PropertyReference propertyReference2 = DesignTimeProperties.GetShadowPropertyReference(propertyReference1, (ITypeId)null);
                 if (propertyReference2 != null)
                 {
                     IViewObject parent = this.TextRange.Start.Parent;
                     obj = DesignTimeProperties.UseShadowPropertyForInstanceBuilding(this.DocumentContext.TypeResolver, (IPropertyId)propertyReference[0]) ? parent.GetCurrentValue(propertyReference2) : SceneNode.GetComputedValueWithShadowCoercion(propertyReference1, propertyReference2, parent.PlatformSpecificObject);
                 }
             }
             return(this.ConvertFromWpfValue(obj));
         }
         propertyReference = this.DesignerContext.PropertyManager.FilterProperty((SceneNode)this.TextEditProxy.TextSource, propertyReference);
     }
     if (propertyReference != null)
     {
         return(this.TextEditProxy.TextSource.GetComputedValue(propertyReference));
     }
     return((object)null);
 }