Switching the Windows 11 theme's color variation to a different one is not correctly applied with the Mica effect. This is present when the Windows 11 version is 22621.
A temporary resolution is to stop the Mica effect by setting the WindowEffectsHelper.BackdropMaterial property on the RadWindow to None.
<telerik:RadWindow x:Class="Example.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
xmlns:helpers="clr-namespace:Telerik.Windows.Controls.Theming.Helpers;assembly=Telerik.Windows.Controls"
helpers:WindowEffectsHelper.BackdropMaterial="None"
Header="RadWindow">
An alternative approach would be to use DynamicResource when basing the custom style for the RadWindow on its default one. Also, when changing the color variation, the merged resource dictionaries could be cleared and then merged again. This way, the Mica effect will not have to be turned off.
<telerik:RadWindow xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" x:Class="Example.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WindowWindows11ThemeTest"
mc:Ignorable="d"
Style="{DynamicResource RadWindowStyle}"
Header="MainWindow" Height="450" Width="800">
private bool isDarkPalette;
private void RadButton_Click(object sender, RoutedEventArgs e)
{
if (this.isDarkPalette)
{
Windows11Palette.LoadPreset(Windows11Palette.ColorVariation.System);
this.isDarkPalette = false;
}
else
{
Windows11Palette.LoadPreset(Windows11Palette.ColorVariation.Dark);
this.isDarkPalette = true;
}
this.MergeDictionaries();
}
private void MergeDictionaries()
{
Application.Current.Resources.MergedDictionaries.Clear();
Application.Current.Resources.MergedDictionaries.Add(new ResourceDictionary()
{
Source = new Uri("/Telerik.Windows.Themes.Windows11;component/Themes/System.Windows.xaml", UriKind.RelativeOrAbsolute)
});
Application.Current.Resources.MergedDictionaries.Add(new ResourceDictionary()
{
Source = new Uri("/Telerik.Windows.Themes.Windows11;component/Themes/Telerik.Windows.Controls.xaml", UriKind.RelativeOrAbsolute)
});
Application.Current.Resources.MergedDictionaries.Add(new ResourceDictionary()
{
Source = new Uri("/Telerik.Windows.Themes.Windows11;component/Themes/Telerik.Windows.Controls.Navigation.xaml", UriKind.RelativeOrAbsolute)
});
}
If the autohiding feature of the taskbar is enabled and RadWindow is maximized, the taskbar is not displayed when the mouse is over the bottom of the screen.
This is observed also in RadTabbedWindow.
If you open the window on a specific resolution, maximize it and then change the resolution to a bigger one, the window size is not updated. The window stays in the original resolution of the screen.
To work this around subscribe to the SystemEvents.DisplaySettingsChanged event and reset the WindowState of RadWindow.
public MainWindow() // where MainWindow is RadWindow
{
InitializeComponent();
SystemEvents.DisplaySettingsChanged += SystemEvents_DisplaySettingsChanged;
}
private void SystemEvents_DisplaySettingsChanged(object sender, EventArgs e)
{
if (this.WindowState == WindowState.Maximized)
{
this.WindowState = WindowState.Normal;
this.WindowState = WindowState.Maximized;
}
}
Hello,
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:
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/PM</dpiAware>
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.