使用透明度的windows.xaml的性能问题 - 不透明度

时间:2017-11-17 14:55:11

标签: c# wpf xaml opacity

我刚刚意识到我的一些Window.xaml正在以某种延迟打开,打开时不像其他Window.xaml(表单)那样不使用透明度。

所以我只是弄清楚它可能与透明度有关或者我错了,不管怎样,这就是我打开窗户时的样子:

中间有一个白色背景的小网格,窗口的背景是透明的。

enter image description here

这是我的代码(我没有在打开的窗口后面提供带蓝色边框的文本框代码)

<Window
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:sys="clr-namespace:System;assembly=mscorlib"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:ed="http://schemas.microsoft.com/expression/2010/drawing" mc:Ignorable="d"
    x:Class="TEST"
    x:Name="Window"
    Title="TEST"
    Width="1024" Height="768" ResizeMode="NoResize" WindowStartupLocation="CenterScreen" WindowState="Maximized" WindowStyle="None" AllowsTransparency="True" >

   <Window.Background>
         <SolidColorBrush Color="Black" Opacity="0.4" />
    </Window.Background>

    <Grid x:Name="LayoutRoot">
        <Grid Width="640" Height="440" Background="White">
            <Grid.Effect>
                <DropShadowEffect BlurRadius="20" RenderingBias="Quality" ShadowDepth="1"/>
        </Grid.Effect>
    </Grid>

</Window>

所以大家我意识到有时甚至会导致应用程序没有响应,当我用不透明度快速打开这个窗口时,看起来CPU无法像我打开它那样快速渲染它。 我需要经常打开它,我担心它可能会破坏我的应用程序..

是否有任何解决方案,因为我在我的应用程序中使用的另一个窗口打开非常快,并且没有问题。

0 个答案:

没有答案
相关问题