I've found a new bug regarding per-monitor DPI awareness in the latest WPF controls build (2020.1.115).
Applications start fine on the modern Windows 10 systems (1607 or later) but crash on previous Windows versions.
The conditions to reproduce:
Here is the stack trace:
System.EntryPointNotFoundException: Unable to find an entry point named 'GetDpiForSystem' in DLL 'User32.dll'. at Telerik.Windows.Controls.InternalWindow.Standard.NativeMethods.GetDpiForSystem() at Telerik.Windows.Controls.InternalWindow.Standard.DpiHelper.GetSystemScaleFactor() at Telerik.Windows.Controls.InternalWindow.Standard.DpiHelper.CalculateScaleFactor(IntPtr hwnd) at Telerik.Windows.Controls.InternalWindow.Standard.DpiHelper.GetPerMonitorDPIAwareScaleFactor(IntPtr hwnd) at Telerik.Windows.Controls.InternalWindow.ChromelessWindowHelper.<Initialize>b__81_0(Object sender, EventArgs args) at System.Windows.Window.OnSourceInitialized(EventArgs e) at System.Windows.Window.CreateSourceWindow(Boolean duringShow) at System.Windows.Window.CreateSourceWindowDuringShow() at System.Windows.Window.SafeCreateWindowDuringShow() at System.Windows.Window.ShowHelper(Object booleanBox) at System.Windows.Window.Show() at Telerik.Windows.Controls.InternalWindow.WindowWithNoChromeWindowHost.Open(Boolean isModal) at Telerik.Windows.Controls.WindowBase.ShowWindow(Boolean isModal) at Telerik.Windows.Controls.RadWindow.Show() at TelerikWpfCrash.App.OnStartup(StartupEventArgs e) in C:\Users\fedarovich\source\repos\Test\TelerikWpfCrash\TelerikWpfCrash\App.xaml.cs:line 20
The issue happens because the code calls the WinAPI functions not available on these OS versions (for example, GetDpiForSystem, but maybe there are more).
I've attached a small example to reproduce this issue. It is for .Net Core 3.1, but the same issue exists in .Net Framework too.
After fixing this BUG (Release LIB 2019.3.930), an additional issue is found.
A window is in Maximized or Normal state, click on the application icon in the taskbar to minimize it and click again to restore the window. It gets clipped to ~160*26 pixels. After clicking on this header, it gets restored to Maximized or Normal state depending on the initial state.
I have a two-monitor setup with identical resolutions (FullHD on both monitors) and Scale is 100% on both monitors.
Initial BUG was fixed in recent update.
One issue still exists:
When minimizing a window that is maximized in the way the intial issue described the problem, and you reactivate it by clicking on its "TaskBarIcon", the window gets clipped incorrectly again.
This is reproducible when you disable the automation peers by setting the AutomationManager.AutomationMode static property to Disabled.
It happens when you open a new RadWindow dialog (using the ShowDialog method), and the close it. After this, when you interact with the main window (click a button, hover a GridView, etc.) the exception occurs.
The exception is thrown only in the Output pane of Visual Studio and it doesn't cause any harm to the application. You can safely ignore it.
The exception message is "Invalid window handle".
To work this around you can enable the "Enable Just My Code" option in Visual Studio.
Moving a window fast on low performance machine or between two monitors causes incorrect offset to be applied to the mouse cursor
This happens when RadWindowInteropHelper.AllowTransparency is set to False and RadWindow is implemented as UserControl. The Window need to be maximized firstly on the main screen and then on the secondary in order for issue to be reproduced. The issue also affects the ToolWindow that RadDocking uses for its floating Pane. In order to reproduce the problem, the primary monitor needs to have its DPI higher than the secondary one.
When EventBinding is used in XAML to bind commands to events of Window or RadRibbonWindow (as it inherits Window), InvalidOperationException is thrown in design-time. Workarounds: 1. Attach an event handler directly to the events of the Window (RadRibbonWindow) 2. (more MVVM-friendly) use Behavior to attach the appropriate event handler.
Available with the R3 2016 SP1 release.
Setting the Owner property to null in order to detach the minimize behavior of linked RadWindow instance to its owner does not take effect unless the RadWindow instance is closed and reopened. Available with the R3 2016 SP1 release.
1) Open WPF Demos and maximize it 2) Open "Alert, Prompt and Confirm" sample 3) Click "Confirm" 4) Minimize all windows (for example, by using Win+D) 5) Switch to WPF Demos again 6) Now you can't do anithing with the window, even close it. You can use task manager to close it.
If a ContentControl is placed inside the control and the ResizeMode is set to NoResize the SizeToContent doesn't take effect. As a workaround all you need to do is set the ResizeMode to NoResize in the Loaded event of the ContentControl.
The thrown error is that the element that should be set as FocusedElement cannot be found. Available in LIB version 2016.2.606, it will be also available in the 2016 R2 SP1 release.
When the attached TextOptions.TextFormattingMode="Display" property is set to the RadWindow the window stops auto resizing its size according to the size of its content.