WPF窗口样式的比较

WPF窗口样式的比较

1.WPF默认Window窗口 带有图标 标题栏 最小最大化推出按钮
csharp 复制代码
<Window x:Class="GlowWindowDemo.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:GlowWindowDemo"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">
    <Grid>
        
    </Grid>
</Window>
2.HandyControl拓展的Window窗口 隐藏了默认图标
csharp 复制代码
<hc:Window
    x:Class="GlowWindowDemo.Window3"
    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:hc="https://handyorg.github.io/handycontrol"
    xmlns:local="clr-namespace:GlowWindowDemo"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    Title="Window3"
    Width="800"
    Height="450"
    WindowStartupLocation="CenterScreen"
    mc:Ignorable="d">
    <Grid />
</hc:Window>

新增属性:

3.HandyControl拓展的GlowWindow窗口 窗口边框可设置显示颜色 辉光效果
csharp 复制代码
<hc:GlowWindow
    x:Class="GlowWindowDemo.Window2"
    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:hc="https://handyorg.github.io/handycontrol"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    Title="Window2"
    Width="800"
    Height="450"
    ActiveGlowColor="{DynamicResource PrimaryColor}"
    Background="{DynamicResource MainContentBackgroundBrush}"
    InactiveGlowColor="{DynamicResource DangerColor}"
    Style="{StaticResource WindowGlow}"
    WindowStartupLocation="CenterScreen"
    mc:Ignorable="d">
    <Border Margin="10" Background="{DynamicResource LightInfoBrush}" />
</hc:GlowWindow>
4.GlowWindow非客户端区域的设置 可自定义标题栏内容 设置显示的Log 文字等
csharp 复制代码
<hc:GlowWindow
    x:Class="GlowWindowDemo.Window4"
    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:hc="https://handyorg.github.io/handycontrol"
    xmlns:local="clr-namespace:GlowWindowDemo"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    Title="Window4"
    Width="800"
    Height="450"
    Background="{DynamicResource RegionBrush}"
    ShowTitle="False"
    WindowStartupLocation="CenterScreen"
    mc:Ignorable="d">

    <!--  标题栏内容  -->
    <hc:GlowWindow.NonClientAreaContent>

        <StackPanel Background="{DynamicResource DarkInfoBrush}" Orientation="Horizontal">
            <hc:OutlineText
                Margin="3"
                Fill="{DynamicResource ColorPickerRainbowBrush}"
                FontSize="32"
                FontWeight="Bold"
                StrokeThickness="2"
                Text="Hello WPF" />
        </StackPanel>
    </hc:GlowWindow.NonClientAreaContent>
    <Grid />
</hc:GlowWindow>

注:当设置标题栏背景颜色时,鼠标在标题栏区域无法拖动窗口移动!!!


不设置标题栏背景颜色时,鼠标在标题栏区域可拖动窗口移动!!!

相关推荐
暮雪倾风2 小时前
【WPF开发】如何设置窗口背景颜色以及背景图片
ui·wpf
暮雪倾风14 小时前
【WPF开发】超级详细的“文件选择”(附带示例工程)
windows·wpf
明耀18 小时前
WPF RadioButton 绑定boolean值
c#·wpf
暮雪倾风20 小时前
【WPF开发】控件介绍-Grid(网格布局)
windows·wpf
芝麻科技2 天前
使用ValueConverters扩展实现枚举控制页面的显示
wpf·prism
笑非不退3 天前
Wpf Image 展示方式 图片处理 显示
开发语言·javascript·wpf
△曉風殘月〆3 天前
在WPF中实现多语言切换的四种方式
wpf·多语言切换
笑非不退3 天前
WPF C# 读写嵌入的资源 JSON PNG JPG JPEG 图片等资源
c#·wpf
He BianGu3 天前
演示:基于WPF的DrawingVisual开发的频谱图和律动图
wpf·示波器·曲线图·频谱分析仪·频谱图·高性能曲线·自绘
笑非不退6 天前
WPF 设计属性 设计页面时实时显示 页面涉及集合时不显示处理 设计页面时显示集合样式 显示ItemSource TabControl等集合样式
wpf