コード例 #1
0
        /// <summary>
        /// Utility method that creates a new EditorAttribute for the specified
        /// PropertyValueEditor
        /// </summary>
        /// <param name="editor">PropertyValueEditor instance for which to create
        /// the new EditorAttribute</param>
        /// <returns>New EditorAttribute for the specified PropertyValueEditor</returns>
        public static EditorAttribute CreateEditorAttribute(PropertyValueEditor editor)
        {
            if (editor == null)
            {
                throw FxTrace.Exception.ArgumentNull("editor");
            }

            return(CreateEditorAttribute(editor.GetType()));
        }
コード例 #2
0
        /// <summary>
        /// Helper class that attempts to find the DataTemplate for the requested PropertyContainerEditMode
        /// given the currently displayed PropertyEntry and the currently set default PropertyValueEditors.
        ///
        /// If the requested DataTemplate is found on the PropertyValueEditor associated with the displayed
        /// control, is it returned.
        ///
        /// Otherwise if the requested DataTemplate is found on DefaultStandardValuesPropertyValueEditor,
        /// it is returned.
        ///
        /// Otherwise if the requested DataTemplate is found on DefaultPropertyValueEditor,
        /// it is returned.
        ///
        /// Otherwise null is returned.
        /// </summary>
        /// <param name="editMode">The editMode for which the DataTemplate should be retrieved</param>
        /// <returns>Most relevant DataTemplate for the specified edit mode based on the currently
        /// displayed PropertyEntry and the current set of default PropertyValueEditors, or null if not
        /// found.</returns>
        private DataTemplate FindPropertyValueEditorTemplate(PropertyContainerEditMode editMode)
        {
            PropertyEntry       property          = this.PropertyEntry;
            PropertyValueEditor editor            = null;
            DataTemplate        requestedTemplate = null;

            // Look at property
            if (property != null)
            {
                editor = property.PropertyValueEditor;
                if (editor != null)
                {
                    requestedTemplate = editor.GetPropertyValueEditor(editMode);
                }
            }

            if (requestedTemplate != null)
            {
                return(requestedTemplate);
            }

            // Is the property of type enum and used as flags?
            if (IsFlagsProperty(property))
            {
                requestedTemplate = this.GetFlagEditorTemplate(editMode);
            }

            if (requestedTemplate != null)
            {
                return(requestedTemplate);
            }

            // Does the property have standard values?
            if (property != null && property.HasStandardValuesInternal)
            {
                editor = this.DefaultStandardValuesPropertyValueEditor;
                if (editor != null)
                {
                    requestedTemplate = editor.GetPropertyValueEditor(editMode);
                }
            }

            if (requestedTemplate != null)
            {
                return(requestedTemplate);
            }

            // Use the default
            editor = this.DefaultPropertyValueEditor;
            if (editor != null)
            {
                requestedTemplate = editor.GetPropertyValueEditor(editMode);
            }

            return(requestedTemplate);
        }
コード例 #3
0
            // Clear everything this class caches
            public void ClearAll() 
            {
                _categoryName = null;
                _description = null;
                _isAdvanced = null;
                _isBrowsable = null;
                _propertyValueEditor = null;
                _propertyOrder = null;
                _categoryEditorTypes = null;
                _displayName = null;

                // Internal properties we don't bind to and, hence,
                // don't need to fire PropertyChanged event:
                _isAttached = null;

                ClearValueRelatedCacheItems();

                _parent.OnPropertyChanged("CategoryName");
                _parent.OnPropertyChanged("Description");
                _parent.OnPropertyChanged("IsAdvanced");
                _parent.OnPropertyChanged("IsBrowsable");
                _parent.OnPropertyChanged("PropertyValueEditor");
                _parent.OnPropertyChanged("PropertyOrder");
                _parent.OnPropertyChanged("CategoryEditorTypes");
                _parent.OnPropertyChanged("DisplayName");
            }
コード例 #4
0
        /// <summary>
        /// Utility method that creates a new EditorAttribute for the specified
        /// PropertyValueEditor
        /// </summary>
        /// <param name="editor">PropertyValueEditor instance for which to create
        /// the new EditorAttribute</param>
        /// <returns>New EditorAttribute for the specified PropertyValueEditor</returns>
        public static EditorAttribute CreateEditorAttribute(PropertyValueEditor editor) {
            if (editor == null)
                throw FxTrace.Exception.ArgumentNull("editor");

            return CreateEditorAttribute(editor.GetType());
        }