如何将资源添加为依赖项属性的description属性以进行本地化

时间:2015-12-05 14:45:03

标签: vb.net localization attributes dependency-properties

我在自定义控件中有一个依赖项属性,它具有以下属性,使属性能够显示在属性查看器中具有相关描述的特定类别下。

<Category("Vtl Button Images"), Description("Add an image of your choice or leave blank to utilise the default image supplied.")>
Public Property SaveImage As ImageSource

现在我想本地化属性的description元素,所以我在项目中添加了一个资源字符串,并试图像这样引用它。

<Category("Vtl Button Images"), Description(My.Resources.ImageDescription)>
Public Property SaveImage As ImageSource

然而,这会抛出一个错误,告诉我需要一个常量表达式。如果我尝试创建一个设置为资源的常量,我会得到同样的错误。

那么可以本地化像这样的属性的描述元素,如果是这样的话?

0 个答案:

没有答案