Skip to content

PropertyGrid: Nullable types unsupported #819

@SamirKharchi

Description

@SamirKharchi

Describe the bug
Nullable properties, e.g. DateTime? are not detected as known by the PropertyResolver even though there is for example a DateTimePropertyEditor.

To Reproduce
Simply define any nullable property in the demo model which non-nullable type is known, e.g. DateTime? or similar.

Expected behavior
Should be supported due to the native nature of nullable types.

Environment:

  • .net: 5.0
  • IDE VS2019 latest
  • Version 3.1.0

Fix is easily done by adding the following to the beginning of PropertyResolver::CreateDefaultEditor(Type type):

var underlyingType = Nullable.GetUnderlyingType(type); if(underlyingType is not null) { type = underlyingType; }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions