none
wpf 窗口或布局容器或listviev控件的透明度如何设置。而且不将子控件透明掉。 RRS feed

答案


  • Hi 轮回的齿轮,

    两种方法可以试一下:

    1.在Window标签内设置AllowsTransparency 和Background:

    <Window x:Class="ChangeTheOpacity.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:ChangeTheOpacity"
            mc:Ignorable="d"
            Title="MainWindow" Height="350" Width="525"
            WindowStyle="None"  AllowsTransparency="True" Background="#00000000">
    
    </Window>

    2.使用SolidColorBrush,可以参考这个帖子:
    https://social.msdn.microsoft.com/Forums/zh-CN/37ab669f-e913-4921-917e-7c52a1bd18ef/wpf-?forum=wpfzhchs

    Best Regards,

    Yohann Lu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    2016年11月28日 4:41
    版主