2013-04-10 76 views
1

TI'm在讓我的窗口透明時遇到了一些麻煩。WPF窗口不能正確顯示透明度

的窗口定義如下:

<Window x:Class="HKC.Desktop.Views.UserInterfaces.RemoteKeypad" 
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
     Closing="Window_Close" 
     KeyDown="RemoteKeypad_KeyDown" 
     KeyUp="RemoteKeypad_KeyUp" MouseDown="OnMouseDown_Event" 
     Title="Title" Width="325" Height="370" 
     ResizeMode="NoResize" WindowStartupLocation="CenterScreen" WindowStyle="None" AllowsTransparency="True" Background="Transparent"> 

然後我有定義,得到的彎曲邊緣的窗口的邊界,與內部佈局的目的網格:

<Border CornerRadius="20" Background="Transparent" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> 
    <Border.Effect> 
      <DropShadowEffect BlurRadius="6" ShadowDepth="3" Color="#484948" /> 
    </Border.Effect> 
    <Grid Background="Transparent" VerticalAlignment="Stretch"> 
      .... 
    </Grid> 
</Border> 
</Window> 

出於某種原因,我第一次打開窗戶背景不透明

enter image description here

但是,如果我從窗口中單擊,退回到上面,透明度按預期工作。

+0

你在windows-xp上嗎? – makim 2013-04-10 10:25:13

+0

不,我在Windows 7上 – binncheol 2013-04-10 10:26:17

回答

0

原來,問題出在用外部工具將陰影添加到元素。