WPF UI界面控件篇

醉酒当歌 提交于 2019-12-09 04:00:28

WPF UI界面控件篇

布局控件:是任何用户界面的基础,排列应用中的 UI 元素。 文本、按钮和图像等元素都需要规定自己位置和行为方式,构建基块称为“控件”,有时亦称为“元素”。

<Window x:Class="UsingLayoutsApp.Wpf.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:UsingLayoutsApp.Wpf"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">
    <Grid>

    </Grid>
</Window>

父元素和子元素

Window 元素只支持包含一个子元素。 Grid 元素支持包含所需的任意多个子元素。 Grid 是用途最广泛的布局元素之一。 它通常用作应用页面的主布局控件。

常用控件

Grid 网格控件 可包含多个子控件
StackPanel
StackPanel 是将项彼此堆叠在一起的简单布局控件,StackPanel 的默认堆叠策略是垂直
DockPanel
WrapPanel
TextBlock 只读文本框
DataGrid 列表数据显示控件
ListView(可用DataGrid代替)
ListBox
GroupBox
MediaElement
Menu
TabControl

图片来源:https://www.cnblogs.com/hegezhou_hot/archive/2012/10/19/2731148.html
在这里插入图片描述在这里插入图片描述

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!