Microsoft has rolled out .NET Framework 4.8 Preview build 3673. The update release note presents multiple significant fixes for ASP.NET, BCL, ClickOnce, CLR, Networking, SQL Windows Forms, and WorkFlow with VSTS bug ID.
Build 3673 for the .NET Framework 4.8 comes up with important improvements in WPF. The support for Per-Monitor V2 DPI Awareness furthermore Mixed-Mode DPI scaling in this edition is the prime feature of this preview edition.
.NET Framework 4.8 Preview build 3673 Changes, Features, and Fixes Details
You must know that Microsoft is involved in the development of the preview version of .NET Framework and will provide you with additional features and fixes in future builds. The builds don’t support the production version. Instead, you will get the versions
The upcoming update of Windows 10 will contain .NET Framework build 3673. You can take a free membership of Windows Insiders to validate that your apps perform well the latest .NET Framework in the latest Windows 10 releases.
Changes in WPF area
[WPF] – High DPI Enhancements
WPF – High DPI Enhancement
The most recent Developer Guide to Per monitor application development in WPF affirms that only pure-WPF applications will work seamlessly in a high-DPI WPF application. The feature will not completely support Hosted HWNDand Windows Forms controls.
.NET 4.8 3673 makes support for hosted HWND’s and Windows Forms interoperation better in High-DPI WPF applications. This is effective on platforms that support Mixed-Mode DPI scaling (Windows 10 version 1803). When hosted either HWNDm or Windows Forms, controls are created as Mixed-Mode DPI scaled windows.
SetThreadDpiHostingBehavior and SetThreadDpiAwarenessContext API’s), it will be feasible to host these types of content in a Per-Monitor V2 WPF application and have them be sized and scaled correctly. Such hosted content will not be rendered at the native DPI – despite the OS will scale the hosted content to the proper size.
The support of .NET 4.8 3673 for Per-Monitor v2 DPI awareness mode also permits WPF controls to be hosted (aka parented) within a native window in a high DPI application. Per-Monitor V2 DPI Awareness support will be available on Windows 10 version 1607. Windows includes support for child-HWND to obtain notifications for DPI change when Per-Monitor V2 DPI Awareness mode is turned on through the application manifest.
WPF leverages the support by to confirm that controls that are hosted within a native window can respond to DPI changes and update automatically. For instance, a WPF control hosted in either Windows Forms or Win32 application manifested as Per Monitor V2 will onward capable of responding appropriately to DPI changes and update itself.
Remember that Windows supports Mixed-Mode DPI scaling on Win10 version 1803, whereas Per-Monitor V2 on version 1607 further.
To test these features, enable below application manifest and AppContext flags –
Enable Per-Monitor DPI in the application
Enable Per-Monitor V2 in your app.manifest
<!-- The combination of below two tags have the following effect :
1) Per-Monitor V2 for OS >= Windows 10 v1703
2) Per-Monitor for 8.1 <= OS < Windows 10 v1703
2) System OS < 8.1
Enable High DPI support in WPF
Add AppContext switch in app.config
Set AppContextSwitch Switch.System.Windows.DoNotUsePresentationDpiCapabilityTier2OrGreater=false in App.Config to turn on Per-Monitor V2 moreover Mixed-Mode DPI support.
The runtime section in the final App.Config might appear as follow –
<AppContextSwitchOverrides value = "Switch.System.Windows.DoNotScaleForDpiChanges=false; Switch.System.Windows.DoNotUsePresentationDpiCapabilityTier2OrGreater=false"/>
AppContext switches can also be enabled in the registry. You can refer to the AppContext Class for extra documentation.
Download .NET 4.8 Developer Pack build 3673