Skip to content

[Breaking change]: ListBox.DefaultItemHeight constant field is marked as obsolete #33953

@Tanya-Solyanik

Description

@Tanya-Solyanik

Description

ListBox.DefaultItemHeight is no longer used as the default item height for the ListBox control because now item height is proportional to the current application font. This change is necessitated by the introduction of the new default font for WinForms controls in .NET Core 3.1.

Version

.NET 8 Preview 2

Previous behavior

Applications referencing ListBox.DefaultItemHeight constant compiled with no warnings related to this value.

New behavior

Applications referencing ListBox.DefaultItemHeight constant will compile with the following warning:
WFDEV004: ListBox.DefaultItemHeight` constant is no longer used as the default item height. Default item height is now scaled according to the application default font.

Type of breaking change

  • Binary incompatible: Existing binaries may encounter a breaking change in behavior, such as failure to load or execute, and if so, require recompilation.
  • Source incompatible: When recompiled using the new SDK or component or to target the new runtime, existing source code may require source changes to compile successfully.
  • Behavioral change: Existing binaries may behave differently at run time.

Reason for change

The new default ListBox item height value is calculated dynamically, based on the application font.

Recommended action

Use Control.DefaultFont.Height values instead.

Feature area

Windows Forms

Affected APIs

ListBox.DefaultItemHeight


Associated WorkItem - 63465

Metadata

Metadata

Assignees

Labels

📌 seQUESTeredIdentifies that an issue has been imported into Quest.breaking-changeIndicates a .NET Core breaking changesource incompatibleSource code may encounter a breaking change in behavior when targeting the new version.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions