【问题标题】:WPF Window Not Showing Transparency CorrectlyWPF 窗口未正确显示透明度
【发布时间】:2013-04-02 03:07:24
【问题描述】:

TI 在让我的窗口透明时遇到了一些麻烦。

窗口定义如下:

<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>

由于某种原因,我第一次打开窗口时背景不透明

但是,如果我在窗口之外单击,然后再返回,透明度会按预期工作。

【问题讨论】:

  • 你在 windows-xp 上吗?

标签: wpf xaml user-interface window


【解决方案1】:

原来问题在于向元素添加投影的外部工具。

【讨论】:

    猜你喜欢
    • 2020-08-18
    • 1970-01-01
    • 2018-01-13
    • 1970-01-01
    • 2011-03-26
    • 2022-01-03
    • 1970-01-01
    • 1970-01-01
    • 2023-03-05
    相关资源
    最近更新 更多