CategoryEditor Class
An abstract class for creating custom category editors.
Namespace: Microsoft.Windows.Design.PropertyEditing
Assembly: Microsoft.Windows.Design (in Microsoft.Windows.Design.dll)
Syntax
'Declaration
Public MustInherit Class CategoryEditor
'Usage
Dim instance As CategoryEditor
public abstract class CategoryEditor
public ref class CategoryEditor abstract
public abstract class CategoryEditor
Remarks
Derive from this class to provide a custom CategoryEditor for a set of properties in a property browser host. This class represents a custom user interface for editing a related set of properties, such as the properties in the Text category.
The TargetCategory property indicates the category of related properties that this editor is meant to edit. For example, several text-related properties are displayed in the Properties window under the Text category. If an editor is designed to edit these properties, the TargetCategory property returns "Text".
The EditorTemplate property returns the XAML template for the visual interface for this editor. This is typically provided in a ResourceDictionary elsewhere in the project.
Note that before a CategoryEditor will be used by the designer, it must be registered. For more information, see IRegisterMetadata.
Examples
The following code example shows how to use the CategoryEditor class. For more information, see Walkthrough: Creating a Category Editor.
Public Class TextCategoryEditor
Inherits CategoryEditor
' The EditorResources class in this example inherits ResourceDirectory and
' contains the template for the category editor. This would be defined in
' an associated XAML file named EditorResources.xaml
Private res As New EditorResources()
Public Overrides Function ConsumesProperty(ByVal prop As PropertyEntry) As Boolean
Return True
End Function
Public Overrides ReadOnly Property EditorTemplate() As System.Windows.DataTemplate
Get
Return CType(res("TextCategoryEditorTemplate"), DataTemplate)
End Get
End Property
Public Overrides Function GetImage(ByVal desiredSize As System.Windows.Size) As Object
Return Nothing
End Function
Public Overrides ReadOnly Property TargetCategory() As String
Get
Return "Text"
End Get
End Property
End Class
public class TextCategoryEditor : CategoryEditor
{
// The EditorResources class in this example inherits ResourceDictionary
// and contains template for the category editor. This would be
// defined in an associated XAML file named EditorResources.xaml
private EditorResources res = new EditorResources();
public TextCategoryEditor()
{
}
public override bool ConsumesProperty(PropertyEntry property)
{
return true;
}
public override DataTemplate EditorTemplate
{
get
{
return res["TextCategoryEditorTemplate"] as DataTemplate;
}
}
public override object GetImage(Size desiredSize)
{
return null;
}
public override string TargetCategory
{
get { return "Text"; }
}
}
Inheritance Hierarchy
System.Object
Microsoft.Windows.Design.PropertyEditing.CategoryEditor
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
See Also
Reference
Microsoft.Windows.Design.PropertyEditing Namespace