-
Notifications
You must be signed in to change notification settings - Fork 1
net90_PropertyGridHelpers.Attributes_ResourcePathAttribute_ResourcePathAttribute
dparvin edited this page Jan 11, 2026
·
11 revisions
Specifies the location of a resource type (e.g., strings, images, cursors) to be used in conjunction with UI editors, type converters, or design-time attributes.
public ResourcePathAttribute(string resourcePath, string resourceAssembly = null,
ResourceUsage resourceUsage = ResourceUsage.All)| parameter | description |
|---|---|
| resourcePath | The fully qualified name of the resource class (e.g., "MyApp.Resources.MyStrings"). |
| resourceAssembly | Optional assembly name containing the resource. If null, defaults to the calling assembly. |
| resourceUsage | Optional usage flag to indicate what the resource is used for (e.g., strings, images). Defaults to All. |
This attribute can be applied to properties, enum types, or classes to associate them with a strongly-typed resource class (e.g., Properties.Resources). The optional ResourceUsage flag allows specifying what the path is used for, enabling separation of string resources, image resources, and more. If multiple ResourcePathAttributes are applied, the resolution order is:
- Property-level attributes
- Enum type or property type-level attributes
- Class-level attributes (declaring type)
Example 1: Use for enum text
[ResourcePath("MyNamespace.MyEnumResources", resourceUsage: ResourceUsage.Strings)]
public enum ButtonType
{
[EnumText("Primary")]
Primary,
[EnumText("Secondary")]
Secondary
}Example 2: Separate image path for UI editor
[ResourcePath("MyNamespace.ButtonImages", resourceUsage: ResourceUsage.Images)]
public enum ButtonType { ... }- enum ResourceUsage
- class ResourcePathAttribute
- namespace PropertyGridHelpers.Attributes
- assembly PropertyGridHelpers