net472_PropertyGridHelpers.Attributes_AllowBlankAttribute - dparvin/PropertyGridHelpers GitHub Wiki

AllowBlankAttribute class

Specifies whether a blank (empty) value is allowed for a property, typically used in dropdown editors.

[AttributeUsage(AttributeTargets.Property)]
public class AllowBlankAttribute : Attribute

Public Members

name description
AllowBlankAttribute(…) Initializes a new instance of the AllowBlankAttribute class.
static Get(…) Gets the specified context.
Allow { get; } Gets a value indicating whether this AllowBlankAttribute is allowing blank values.
IncludeItem { get; } Gets a value indicating whether to include item an item in the dropdown to indicate blank.
ResourceItem { get; } Gets the resource item to use for displaying the blank item (Leaves it empty when this is not provided).
override ToString() Converts to string.
static GetBlankLabel(…) Gets the blank label.
static IsBlankAllowed(…) Determines whether blank is allowed in the specified context.

Remarks

This attribute is used in conjunction with editors like ResourcePathEditor and converters like OnlySelectableTypeConverter to optionally include a blank entry in the list of selectable values.

Examples

[AllowBlank(includeItem: true, resourceItem: "Blank_DisplayText")]
[Editor(typeof(ResourcePathEditor), typeof(UITypeEditor))]
[TypeConverter(typeof(OnlySelectableTypeConverter))]
public string ResourcePath { get; set; }

See Also

⚠️ **GitHub.com Fallback** ⚠️