我通常在 WPF 用户控件中为自定义属性使用描述属性,如下所示。
[Category("Features"), Description("You can setup image width ratio in double type")]
public double ImageWidthRatio
{
get { return (double)GetValue(ImageWidthRatioProperty); }
set { SetValue(ImageWidthRatioProperty, value); }
}
// Using a DependencyProperty as the backing store for ImageWidthRatioProperty. This enables animation, styling, binding, etc...
public static readonly DependencyProperty ImageWidthRatioProperty =
DependencyProperty.Register("ImageWidthRatio", typeof(double), typeof(TheControl), new UIPropertyMetadata(1.0));
该行在[Category("Features"), Description("You can setup image width ratio")]
“属性”窗口中给出了组的描述。
但是,是 Windows Store App User Control。它说不System.ComponentModel.DesriptionAttribute
。
如何在 WinRT 的“属性”窗口中显示我的属性描述?