コード例 #1
0
        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);
        }
コード例 #2
0
        void IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.UriEditorControl = (UriEditor)target;
                break;

            case 2:
                ((ButtonBase)target).Click += new RoutedEventHandler(this.OnAddItem);
                break;

            default:
                this._contentLoaded = true;
                break;
            }
        }