1. 程式人生 > 其它 >WPF 背景陰影窗體

WPF 背景陰影窗體

 

 

<Window x:Class="WpfApp1.MainWindow"
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        WindowStyle="None" ResizeMode="CanMinimize"
            Title="walterlv demo" Height="450" Width="800">
    <WindowChrome.WindowChrome>
        <WindowChrome GlassFrameThickness="-1" />
    </WindowChrome.WindowChrome>
    <Window.Template>
        <ControlTemplate TargetType="Window">
            <Border Padding="16" Background="Transparent">
                <Border CornerRadius="16" Background="White">
                    <Border.Effect>
                        <DropShadowEffect BlurRadius="33" />
                    </Border.Effect>
                    <ContentPresenter ClipToBounds="True" />
                </Border>
            </Border>
        </ControlTemplate>
    </Window.Template>
    <Grid>
        <TextBlock FontSize="20" Foreground="#0083d0"
                   TextAlignment="Center" VerticalAlignment="Center">
                <Run Text="歡迎訪問呂毅的部落格" />
                <LineBreak />
                <Run Text="blog.walterlv.com" FontSize="64" FontWeight="Light" />
        </TextBlock>
    </Grid>

</Window>