WPF Window 窗口 常用属性

window窗口属性

|---------------------------|----------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ## 属性 | ## 定义 | ## 属性值 | ## 注解 |
| WindowStartupLocation | 获取或设置窗口首次显示时的位置。 | 一个 WindowStartupLocation 值,指定窗口首次显示时的顶边/左边位置。 默认值为 Manual。 | 将 WindowStartupLocation 属性设置为 Manual 使窗口按其 LeftTop 属性值定位。 Left如果未指定或Top属性,则其值由Windows确定。 将 WindowStartupLocation 属性设置为 CenterScreen 使窗口定位在包含鼠标光标的屏幕中心。 将 WindowStartupLocation 属性设置为 CenterOwner 使窗口定位在其所有者窗口的中心 , (如果指定,则会看到 Window.Owner) 。 所有者窗口可以是另一个 WPF 窗口或非 WPF 窗口。 |
| Background | 设置窗口背景(背景透明度) | Background="Transparent" | |
| FontFamily | 设置窗口字体 | FontFamily="Microsoft YaHei" | |
| FontSize | 设置字体大小 | FontSize="12" | |
| FontWeight | 字休加粗 | FontWeight="ExtraLight" | |
| Title | 标题 | | |
| Height | 高度 | | |
| Width | 宽度 | | |
| Name | 名称 | | |
| WindowChrome.WindowChrome | 获取或设置附加到窗口的 WindowChrome 的实例。 | | |

复制代码
<Window x:Class="cjh.Automatic.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:cjh.Automatic"
        mc:Ignorable="d"
        WindowStartupLocation="CenterScreen" Background="Transparent"
        FontFamily="Microsoft YaHei" FontSize="12" FontWeight="ExtraLight"
        Title="XX管理平台" Height="700" Width="1150" Name="windowMain">
    <WindowChrome.WindowChrome>
        <WindowChrome GlassFrameThickness="-1" />
    </WindowChrome.WindowChrome>
    <Grid>
        <Grid.Background>
            <RadialGradientBrush>
                <GradientStop Color="#FF285173" Offset="0" />
                <GradientStop Color="#FF244967" Offset="0.3" />
                <GradientStop Color="#FF14273A" Offset="1" />
            </RadialGradientBrush>
        </Grid.Background>
        <Grid.RowDefinitions>
            <RowDefinition Height="45"/>
            <RowDefinition />
            <RowDefinition Height="20"/>
        </Grid.RowDefinitions>
    </Grid>
</Window>
相关推荐
✎ ﹏梦醒͜ღ҉繁华落℘4 小时前
开发WPF项目时遇到的问题总结
wpf
hqwest1 天前
C#WPF实战出真汁06--【系统设置】--餐桌类型设置
c#·.net·wpf·布局·分页·命令·viewmodel
Vae_Mars1 天前
WPF中使用InputBindings进行快捷键绑定
wpf
hqwest1 天前
C#WPF实战出真汁05--左侧导航
开发语言·c#·wpf·主界面·窗体设计·视图viewmodel
hqwest2 天前
C#WPF实战出真汁01--项目介绍
开发语言·c#·wpf
wuty0072 天前
WPF 实现支持动态调整高度的文本显示控件
wpf·scrollviewer·extentheight·自动高度控件·动态调整高度
范纹杉想快点毕业5 天前
C 语言主控开发与显控开发能力体系及技术栈详解,STM32、QT、嵌入式、边缘系统显示
stm32·单片机·tcp/ip·microsoft·fpga开发·51单片机·wpf
weixin_447103585 天前
WPF之绑定!
c#·wpf
DataIntel5 天前
wpf问题记录
wpf
蓝点lilac7 天前
C# WPF 内置解码器实现 GIF 动图控件
c#·.net·wpf·图像