net90_PropertyGridHelpers.Converters_OnlySelectableTypeConverter - dparvin/PropertyGridHelpers GitHub Wiki

OnlySelectableTypeConverter class

Provides a type converter that restricts input to selectable values only.

public class OnlySelectableTypeConverter : StringConverter

Public Members

name description
OnlySelectableTypeConverter() The default constructor.
override ConvertFrom(…) Converts from a string to a element in an Enum.
override GetStandardValues(…) Returns a list of resource paths found in the current instance’s assembly, suitable for selection in a property grid editor or a dropdown.
override GetStandardValuesExclusive(…)
override GetStandardValuesSupported(…)

Remarks

This converter is used with the ResourcePathEditor to prevent users from manually editing text in the PropertyGrid, while still allowing selection from a predefined dropdown list.

Examples

[AllowBlank(includeItem: true, resourceItem: "Blank_ResourcePath")]
[LocalizedCategory("Category_TestItems")]
[LocalizedDescription("Description_ResourcePath")]
[LocalizedDisplayName("DisplayName_ResourcePath")]
[Editor(typeof(ResourcePathEditor), typeof(UITypeEditor))]
[TypeConverter(typeof(OnlySelectableTypeConverter))]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public string ResourcePath { get; set; }

See Also

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