private bool HasEmptySelectListItem(IReadonlyFieldConfiguration fieldConfiguration) { if (fieldConfiguration.EmptyItemHidden) { return(false); } // If it's a checkbox list then it // shouldn't since you can uncheck everything if (fieldConfiguration.DisplayType == FieldDisplayType.List && FieldGenerator.HasMultipleValues()) { return(false); } // If it's a radio list for a required field then it // shouldn't since no value is not a valid value and // an initial null value translates to none of the radio // boxes being selected if (fieldConfiguration.DisplayType == FieldDisplayType.List) { return(!FieldGenerator.Metadata.IsRequired); } // If it's a multi-select dropdown and required then // there shouldn't be an empty item if (FieldGenerator.HasMultipleValues()) { return(!FieldGenerator.Metadata.IsRequired); } // Dropdown lists for nullable types should have an empty item if (!FieldGenerator.Metadata.ModelType.IsValueType || Nullable.GetUnderlyingType(FieldGenerator.Metadata.ModelType) != null) { return(true); } return(false); }