dotnet / docs

This repository contains .NET Documentation.
https://learn.microsoft.com/dotnet
Creative Commons Attribution 4.0 International
4.28k stars 5.91k forks source link

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

Open Tanya-Solyanik opened 1 year ago

Tanya-Solyanik commented 1 year ago

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

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

gewarren commented 1 year ago

@Tanya-Solyanik It doesn't look like this made it in for Preview 2. Is that correct? https://github.com/dotnet/winforms/pull/8640/files

gewarren commented 11 months ago

Now seems to depend on https://github.com/dotnet/winforms/pull/10142.