Skip to content

net90_PropertyGridHelpers.Attributes_ResourcePathAttribute_ResourcePathAttribute

dparvin edited this page Jan 11, 2026 · 11 revisions

ResourcePathAttribute constructor

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.

Remarks

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:

  1. Property-level attributes
  2. Enum type or property type-level attributes
  3. Class-level attributes (declaring type)

Examples

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 { ... }

See Also

Clone this wiki locally