在WinForms中,我可以在自定义控件属性上添加[Category]属性来指定该属性应包含在哪个属性类别中。在WPF中如何做到这一点?谢谢。
我发现您不必包含设计时DLL来为自定义控件属性添加[Category]属性。这是一种方法,但实际上,您可以像在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); }
}