设置WPF自定义控件的属性类别?

Dav*_*man 10 wpf custom-controls wpf-controls

在WinForms中,我可以将[Category]属性添加到自定义控件属性,以指定应包含属性的属性类别.我如何在WPF中做到这一点?谢谢

Dav*_*man 17

我发现,你不,包括设计时DLL到[类别]属性添加到自定义的控件属性.这是可以完成的一种方式,但实际上,您可以像在WinForms中一样使用任何.NET属性.例如:

/// <summary>
/// The image displayed by the button.
/// </summary>
/// <remarks>The image is specified in XAML as an absolute or relative path.</remarks>
[Description("The image displayed by the button."), Category("Common Properties")] 
public ImageSource Image
{
    get { return (ImageSource)GetValue(ImageProperty); }
    set { SetValue(ImageProperty, value); }
}
Run Code Online (Sandbox Code Playgroud)