在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); }
}
关于wpf - 设置WPF自定义控件的属性类别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1989226/