public static PropertyValueEditor GetPropertyEditorTemplate(PropertyReferenceProperty property) { bool flag = false; IProjectContext projectContext = property.ObjectSet.ProjectContext; PropertyValueEditor propertyValueEditor = PropertyEditorTemplateLookup.GetPropertyEditorTemplate(projectContext, property.ObjectSet.DesignerContext, property.PropertyTypeId); if (propertyValueEditor == PropertyEditorTemplateLookup.ObjectEditorTemplate && property.PropertyValue.CanConvertFromString) { flag = true; propertyValueEditor = (PropertyValueEditor)null; } SceneNodeProperty sceneNodeProperty = property as SceneNodeProperty; if (propertyValueEditor == null) { if (property.Converter != null && property.Converter.GetPropertiesSupported()) { return(PropertyEditorTemplateLookup.ObjectEditorTemplate); } if (sceneNodeProperty != null && UriEditor.IsPropertySupportedOnType((PropertyReferenceProperty)sceneNodeProperty, sceneNodeProperty.SceneNodeObjectSet.ObjectType)) { DataTemplate inlineEditorTemplate = new DataTemplate(); inlineEditorTemplate.VisualTree = new FrameworkElementFactory(typeof(UriEditor)); propertyValueEditor = new PropertyValueEditor(inlineEditorTemplate); } } if (propertyValueEditor == null && !flag) { IType computedValueTypeId = property.ComputedValueTypeId; if (computedValueTypeId != null) { propertyValueEditor = PropertyEditorTemplateLookup.GetPropertyEditorTemplate(projectContext, property.ObjectSet.DesignerContext, computedValueTypeId); if (propertyValueEditor is PropertyEditorTemplateLookup.CollectionDialogPropertyValueEditor) { propertyValueEditor = (PropertyValueEditor)null; } } } if (property.IsReadOnly && !(propertyValueEditor is PropertyEditorTemplateLookup.CollectionDialogPropertyValueEditor) && !ProjectNeutralTypes.LayoutPathCollection.IsAssignableFrom((ITypeId)property.PropertyTypeId)) { return((PropertyValueEditor)null); } if (sceneNodeProperty != null && propertyValueEditor is PropertyEditorTemplateLookup.CollectionDialogPropertyValueEditor) { bool isMixed; DocumentNode valueAsDocumentNode = sceneNodeProperty.GetLocalValueAsDocumentNode(true, out isMixed); if (valueAsDocumentNode != null && valueAsDocumentNode is DocumentPrimitiveNode) { return((PropertyValueEditor)null); } if (property.PropertyTypeId.IsArray && !property.PropertyTypeId.PlatformMetadata.ResolveType(PlatformTypes.ArrayExtension).IsResolvable) { return((PropertyValueEditor)null); } } return(propertyValueEditor); }
private static PropertyValueEditor GetPropertyEditorTemplate(IProjectContext projectContext, DesignerContext designerContext, IType type) { if (PlatformTypes.Double.IsAssignableFrom((ITypeId)type) || PlatformTypes.Double.IsAssignableFrom((ITypeId)type.NullableType)) { return(new PropertyValueEditor((DataTemplate)PropertyEditorTemplateLookup.resources[(object)"DoubleViewTemplate"])); } if (PlatformTypes.Int32.IsAssignableFrom((ITypeId)type)) { return(new PropertyValueEditor((DataTemplate)PropertyEditorTemplateLookup.resources[(object)"IntViewTemplate"])); } if (PlatformTypes.UInt32.IsAssignableFrom((ITypeId)type)) { return(new PropertyValueEditor((DataTemplate)PropertyEditorTemplateLookup.resources[(object)"UIntViewTemplate"])); } if (PlatformTypes.Byte.IsAssignableFrom((ITypeId)type)) { return(new PropertyValueEditor((DataTemplate)PropertyEditorTemplateLookup.resources[(object)"ByteViewTemplate"])); } if (PlatformTypes.Int16.IsAssignableFrom((ITypeId)type)) { return(new PropertyValueEditor((DataTemplate)PropertyEditorTemplateLookup.resources[(object)"ShortViewTemplate"])); } if (PlatformTypes.UInt16.IsAssignableFrom((ITypeId)type)) { return(new PropertyValueEditor((DataTemplate)PropertyEditorTemplateLookup.resources[(object)"UShortViewTemplate"])); } if (PlatformTypes.Single.IsAssignableFrom((ITypeId)type)) { return(new PropertyValueEditor((DataTemplate)PropertyEditorTemplateLookup.resources[(object)"FloatViewTemplate"])); } if (PlatformTypes.TextAlignment.IsAssignableFrom((ITypeId)type)) { DataTemplate inlineEditorTemplate = new DataTemplate(); inlineEditorTemplate.VisualTree = new FrameworkElementFactory(typeof(TextAlignmentValueEditor)); return(new PropertyValueEditor(inlineEditorTemplate)); } if (PlatformTypes.Enum.IsAssignableFrom((ITypeId)type)) { return(new PropertyValueEditor(!EnumsThatUseButtons.ShouldUseButtonsForEnum((ITypeId)type) ? (!EnumsThatUseButtons.ShouldUseToggleButtonsForEnum((ITypeId)type) ? (DataTemplate)PropertyEditorTemplateLookup.resources[(object)"ChoiceComboViewTemplate"] : (DataTemplate)PropertyEditorTemplateLookup.resources[(object)"ChoiceToggleButtonsViewTemplate"]) : (DataTemplate)PropertyEditorTemplateLookup.resources[(object)"ChoiceButtonsViewTemplate"])); } if (PlatformTypes.Boolean.IsAssignableFrom((ITypeId)type) || PlatformTypes.Boolean.IsAssignableFrom((ITypeId)type.NullableType)) { return(new PropertyValueEditor((DataTemplate)PropertyEditorTemplateLookup.resources[(object)"BoolViewTemplate"])); } if (PlatformTypes.String.IsAssignableFrom((ITypeId)type)) { return(new PropertyValueEditor((DataTemplate)PropertyEditorTemplateLookup.resources[(object)"StringViewTemplate"])); } if (PlatformTypes.Vector3D.IsAssignableFrom((ITypeId)type)) { return(new PropertyValueEditor((DataTemplate)PropertyEditorTemplateLookup.resources[(object)"Vector3DEditorTemplate"])); } if (PlatformTypes.Point3D.IsAssignableFrom((ITypeId)type)) { return(new PropertyValueEditor((DataTemplate)PropertyEditorTemplateLookup.resources[(object)"Point3DEditorTemplate"])); } if (PlatformTypes.Point.IsAssignableFrom((ITypeId)type) || PlatformTypes.Vector.IsAssignableFrom((ITypeId)type)) { return(new PropertyValueEditor((DataTemplate)PropertyEditorTemplateLookup.resources[(object)"Point2DEditorTemplate"])); } if (PlatformTypes.Color.IsAssignableFrom((ITypeId)type) || PlatformTypes.Color.IsAssignableFrom((ITypeId)type.NullableType)) { DataTemplate inlineEditorTemplate = (DataTemplate)PropertyEditorTemplateLookup.resources[(object)"ColorViewTemplate"]; return((PropertyValueEditor) new ExtendedPropertyValueEditor((DataTemplate)PropertyEditorTemplateLookup.resources[(object)"ColorExtendedTemplate"], inlineEditorTemplate)); } if (PlatformTypes.Brush.IsAssignableFrom((ITypeId)type)) { DataTemplate inlineEditorTemplate = (DataTemplate)PropertyEditorTemplateLookup.resources[(object)"BrushViewTemplate"]; return((PropertyValueEditor) new ExtendedPropertyValueEditor((DataTemplate)PropertyEditorTemplateLookup.resources[(object)"BrushEditorTemplate"], inlineEditorTemplate)); } if (PlatformTypes.Material.IsAssignableFrom((ITypeId)type)) { DataTemplate extendedEditorTemplate = new DataTemplate(); extendedEditorTemplate.VisualTree = new FrameworkElementFactory(typeof(MaterialEditor)); DataTemplate inlineEditorTemplate = (DataTemplate)PropertyEditorTemplateLookup.resources[(object)"MaterialViewTemplate"]; return((PropertyValueEditor) new ExtendedPropertyValueEditor(extendedEditorTemplate, inlineEditorTemplate)); } if (PlatformTypes.Transform.IsAssignableFrom((ITypeId)type) || PlatformTypes.Transform3D.IsAssignableFrom((ITypeId)type)) { return(new PropertyValueEditor((DataTemplate)PropertyEditorTemplateLookup.resources[(object)"TransformEditorTemplate"])); } if (PlatformTypes.Projection.IsAssignableFrom((ITypeId)type)) { return(new PropertyValueEditor((DataTemplate)PropertyEditorTemplateLookup.resources[(object)"ProjectionEditorTemplate"])); } if (PlatformTypes.Thickness.IsAssignableFrom((ITypeId)type)) { DataTemplate inlineEditorTemplate = new DataTemplate(); inlineEditorTemplate.VisualTree = new FrameworkElementFactory(typeof(ThicknessEditor)); return(new PropertyValueEditor(inlineEditorTemplate)); } if (PlatformTypes.GridLength.IsAssignableFrom((ITypeId)type)) { DataTemplate inlineEditorTemplate = new DataTemplate(); inlineEditorTemplate.VisualTree = new FrameworkElementFactory(typeof(GridLengthEditor)); return(new PropertyValueEditor(inlineEditorTemplate)); } if (PlatformTypes.FontFamily.IsAssignableFrom((ITypeId)type)) { DataTemplate inlineEditorTemplate = new DataTemplate(); inlineEditorTemplate.VisualTree = new FrameworkElementFactory(typeof(FontFamilyValueEditor)); return(new PropertyValueEditor(inlineEditorTemplate)); } if (PlatformTypes.DrawingImage.IsAssignableFrom((ITypeId)type)) { return(new PropertyValueEditor((DataTemplate)PropertyEditorTemplateLookup.resources[(object)"DrawingImageTemplate"])); } if (PlatformTypes.KeySpline.IsAssignableFrom((ITypeId)type)) { return(new PropertyValueEditor((DataTemplate)PropertyEditorTemplateLookup.resources[(object)"KeySplineEditorTemplate"])); } if (PlatformTypes.IEasingFunction.IsAssignableFrom((ITypeId)type)) { return(new PropertyValueEditor((DataTemplate)PropertyEditorTemplateLookup.resources[(object)"EasingFunctionEditorTemplate"])); } if (ProjectNeutralTypes.TransitionEffect.IsAssignableFrom((ITypeId)type)) { return(new PropertyValueEditor((DataTemplate)PropertyEditorTemplateLookup.resources[(object)"TransitionEffectEditorTemplate"])); } if (PlatformTypes.RepeatBehavior.IsAssignableFrom((ITypeId)type)) { return(new PropertyValueEditor((DataTemplate)PropertyEditorTemplateLookup.resources[(object)"RepeatBehaviorEditorTemplate"])); } if (ProjectNeutralTypes.GeometryEffect.IsAssignableFrom((ITypeId)type)) { return(new PropertyValueEditor((DataTemplate)PropertyEditorTemplateLookup.resources[(object)"GeometryEffectEditorTemplate"])); } if (ProjectNeutralTypes.LayoutPathCollection.IsAssignableFrom((ITypeId)type)) { return(new PropertyValueEditor((DataTemplate)PropertyEditorTemplateLookup.resources[(object)"LayoutPathCollectionEditorTemplate"])); } if (PlatformTypes.DoubleCollection.IsAssignableFrom((ITypeId)type)) { return((PropertyValueEditor)null); } if (PlatformTypes.PointCollection.IsAssignableFrom((ITypeId)type)) { return((PropertyValueEditor)null); } if (PropertyEditorTemplateLookup.ShouldUseCollectionEditor((ITypeId)type)) { DataTemplate inlineEditorTemplate = (DataTemplate)PropertyEditorTemplateLookup.resources[(object)"CollectionDialogInlineTemplate"]; return((PropertyValueEditor) new PropertyEditorTemplateLookup.CollectionDialogPropertyValueEditor((DataTemplate)PropertyEditorTemplateLookup.resources[(object)"CollectionDialogEditorTemplate"], inlineEditorTemplate, designerContext.MessageDisplayService)); } if (PropertyEditorTemplateLookup.ShouldUseObjectEditor(type)) { return(PropertyEditorTemplateLookup.ObjectEditorTemplate); } return((PropertyValueEditor)null); }