Telerik Radwindow render incompletely when setting AllowTransparency="False" - wpf

I has a question about radwindow rendering.
When I set the AllowTransparency="False" and ShowInTaskbar="True",
I switch the window by clicking the taskbar icon, the window just rendering the Windows Title and other parts is hidden. I must drag or resize it to recover.
the complete window:
the incomplete window:
So if I set AllowTransparency = True will solve it, but the windows will become slow when drag it.
The telerik version is 2019.3.1023.300, dotnet version: 3.1, windows OS: windown 10 1903
RadWindow Code:
<telerik:RadWindow x:Class="TelerikTest.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:TelerikTest"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
xmlns:navigation="clr-namespace:Telerik.Windows.Controls.Navigation;assembly=Telerik.Windows.Controls.Navigation"
mc:Ignorable="d"
Width="1024"
Height="768"
MinWidth="800"
MinHeight="600"
WindowStartupLocation="CenterScreen"
navigation:RadWindowInteropHelper.AllowTransparency="False"
navigation:RadWindowInteropHelper.ShowInTaskbar="True"
>
<telerik:RadWindow.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Telerik.Windows.Themes.Fluent;component/Themes/System.Windows.xaml" />
<ResourceDictionary
Source="/Telerik.Windows.Themes.Fluent;component/Themes/Telerik.Windows.Controls.Navigation.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</telerik:RadWindow.Resources>
<telerik:RadWindow.Style>
<StaticResource ResourceKey="RadWindowStyle" />
</telerik:RadWindow.Style>
<Grid>
</Grid>
</telerik:RadWindow>

This was a bug in the RadWindow control. It is not marked in the release notes, but it was fixed with the R1 2020 release of Telerik UI for WPF (version 2020.1.115).

Related

TaskBar not shown when we set WindowChrome for Window

I set the system taskbar to autohide, then I ran the WPF application in Maximized state. When the application is in maximized state, I mouse hover the bottom of the screen to view the taskbar but it does not appear. Find the code block below.
<Window x:Class="_189619.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:_189619"
mc:Ignorable="d" WindowState="Maximized"
Title="MainWindow" Height="350" Width="525">
<WindowChrome.WindowChrome>
<WindowChrome CaptionHeight="50" ResizeBorderThickness="3"/>
</WindowChrome.WindowChrome>
<Grid>
</Grid>
</Window>
Any workaround to show the TaskBar?
Thanks in Advance.
Regards,
Priyanga B

Opening new window in MVVM WPF The window is a window, not a user control

I really like the solution from GazTheDestroyer to open a new window in MVVM WPF. My problem is that the window I want to show is a window and windows are not allowed in styles.
I have the following lines in my ResourceDictionary:
<DataTemplate DataType="{x:Type vm:ConfigViewModel}">
<vw:WinOptionsSimu />
</DataTemplate>
In WinOptionsSimu.xaml :
<Window x:Class="SimuDMSDMI.View.WinOptionsSimu"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="WinOptionsSimu" SizeToContent="WidthAndHeight"
WindowStartupLocation="CenterOwner">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/SimuDMSDMI;component/Ressources/DictMainWindow.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<Grid>
...
</Grid>
</Window>
After building the project, the line
is blue underlined and the tooltip shows "Can't put a Window in a style".
How can I solve this ?
Thanks in advance

Linked resource dictionary and StaticResource reference at root level

I'm aware of this, which doesn't apply to my case, and this, which I'm not sure whether it can be adapted.
I'm working on a WPF control library, and I don't have an App.xaml file. I use a file called Styles.xml to store common brushes and other resources. In the XAML file of my user control I import the resources and then I try to use brush sBrush as a background.
This works except that at the root level:
<UserControl x:Class="CMControls.TitledWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300"
Background="{StaticResource ResourceKey=sBrush}"> <!--EXCEPTION!-->
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary
Source="pack://application:,,,/CMControls;component/Styles.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Canvas Background="{StaticResource ResourceKey=sBrush}" ... <!--Ok.-->
...
I presume this happens because when the root element is instantiated its children are not, including UserControl.Resources. Is there any workaround? Note that in the designer everything works fine, no matter where I make the reference.
Change UserControl Background after Resource Merging line,because you have to add resources before using them!
<UserControl x:Class="CMControls.TitledWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary
Source="pack://application:,,,/CMControls;component/Styles.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<UserControl.Background> <!--Set background here!-->
<StaticResource ResourceKey="sBrush"></StaticResource>
</UserControl.Background>
...

MahApps.Metro: Disabling windows animation

I'm using MahApps.Metro UI for my WPF application. It's a good one and satisfies my needs, but I'd be more happy if somebody told me how to disable windows animation when they pop up.
When I call the Show() method, the new window pops up and I see an annoying animation (the content slides from right to left). The effect is similar to another one shown on the picture below (but it shows tabs and content goes left-to-right):
Sample of a dummy form please see below:
<controls:MetroWindow x:Class="TestProj.Views.TestView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
xmlns:vm="clr-namespace:TestProj.ViewsModels"
Height="230" Width="550">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colours.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<Grid>
</Grid>
</controls:MetroWindow>
Set WindowTransitionsEnabled="False" in xaml of the window.
As discussed on the equivalent GitHUb issue, the MetroWindow control template by default will use a MetroContentControl (which has this animation).
You need to edit the template to change it back to a ContentControl.
Sample code here

WPF Themes not applying to background

I have a WPF application I am developing, that allows the user to switch the current theme. I figured out how to switch themes... but it appears that the background of the application isn't affected by the theme:
(I blended three pictures together to conserve space)
How can I fix this? It clearly shows here that the background is supposed to change...
Here's the code I'm using:
MainWindow.xaml:
<Window x:Class="GDE.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525" MinWidth="525" MinHeight="350">
<Grid>
....
</Grid>
</Window>
App.xaml:
<Application x:Class="GDE.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary x:Name="ThemeDictionary">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Themes/ExpressionDark.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
The themes define a background but you need to set it up yourself since it is not being referenced anywhere within the theme:
Background="{DynamicResource WindowBackgroundBrush}"
Why? I'd assume because styles are not automatically applied to derived classes, so if a style with theTargetType Window is set up that would also need to be set explicity since normally you use a subclass of Window, e.g. MainWindow.
My guess is that that the background we see in your screenshot does not belong to one of the themes, and this is the problem, you override theming when setting stuff manually.

Resources