当前位置:网站首页>XAML WPF项目groupBox控件
XAML WPF项目groupBox控件
2022-08-01 17:33:00 【济南医疗小程序状元】
<Window x:Class="WpfHello.Number.One.MTL.Demo.WindowGroupBox"
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:WpfHello.Number.One.MTL.Demo"
mc:Ignorable="d"
Title="WindowGroupBox" Height="450" Width="800">
<!--
1 需要注意 heard属性的使用
2 groupbox 的内容可以自由组合
3 我们使用了自定义模板 ==》 Window.Resources 里面使用 ControlTemplate 自定义模板 需要制定Key 需要指定作用目标.
-->
<!--自定义 GroupBox 控件-->
<Window.Resources>
<ControlTemplate x:Key="myGroupBox" TargetType="GroupBox">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="40"> </RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Border Grid.Row="0" Background="Orange">
<Label Foreground="red" FontWeight="Bold" FontSize="18">
这是个业务标题
</Label>
</Border>
<Border Grid.Row="0" Background="AliceBlue">
<TabItem>
<TabItem.Header>_Job Info</TabItem.Header>
<StackPanel>
<TextBlock>Select a job</TextBlock>
<ListBox Name ="job" >
<ListBoxItem IsSelected="true">Programmer</ListBoxItem>
<ListBoxItem>Tester</ListBoxItem>
<ListBoxItem>Writer</ListBoxItem>
<ListBoxItem>Manager</ListBoxItem>
</ListBox>
</StackPanel>
</TabItem>
</Border>
</Grid>
</ControlTemplate>
</Window.Resources>
<Grid>
<GroupBox Template="{StaticResource myGroupBox}">
</GroupBox>
<GroupBox Template="{StaticResource myGroupBox}">
</GroupBox>
<!--<GroupBox Header="GroupBox"/> Header="这个是groupbox的业务标题 "-->
<!--<GroupBox >
--><!-- 栈面板 <StackPanel>
</StackPanel>--><!--
<GroupBox.Header>
<Label Foreground="blue">这个是groupbox的业务标题 </Label>
</GroupBox.Header>
<StackPanel>
<TabControl Name="myTabControl"
TabStripPlacement="Top"
Margin="0, 0, 0, 10" Height="350"
>
<TabItem Name="PersonalInfo">
<TabItem.Header>_Personal Info</TabItem.Header>
<StackPanel>
<TextBlock>Employee</TextBlock>
<TextBlock>Select your name</TextBlock>
<ListBox Name="empName" >
<ListBoxItem IsSelected="true">Esther</ListBoxItem>
<ListBoxItem>George</ListBoxItem>
<ListBoxItem>Alan</ListBoxItem>
<ListBoxItem>Eric</ListBoxItem>
</ListBox>
</StackPanel>
</TabItem>
<TabItem>
<TabItem.Header>_Job Info</TabItem.Header>
<StackPanel>
<TextBlock>Select a job</TextBlock>
<ListBox Name ="job" >
<ListBoxItem IsSelected="true">Programmer</ListBoxItem>
<ListBoxItem>Tester</ListBoxItem>
<ListBoxItem>Writer</ListBoxItem>
<ListBoxItem>Manager</ListBoxItem>
</ListBox>
</StackPanel>
</TabItem>
<TabItem Name="Skill">
<TabItem.Header>_Skill</TabItem.Header>
<StackPanel>
<TextBlock>
Select your strongest skill
</TextBlock>
<ListBox Name="skills" >
<ListBoxItem IsSelected="true">C#</ListBoxItem>
<ListBoxItem>Visual Basic</ListBoxItem>
<ListBoxItem>.NET</ListBoxItem>
<ListBoxItem>JScript</ListBoxItem>
</ListBox>
</StackPanel>
</TabItem>
<TabItem Name="Summary" >
<TabItem.Header>Su_mmary</TabItem.Header>
<StackPanel>
<TextBlock Name="emp"/>
<TextBlock Name="ejob"/>
<TextBlock Name="eskill"/>
</StackPanel>
</TabItem>
</TabControl>
<Button Content="Show Summary" />
</StackPanel>
</GroupBox>-->
</Grid>
</Window>
效果
边栏推荐
猜你喜欢
关于Mysql服务无法启动的问题
ROS2支持技术:DDS简述
史上最全的Redis基础+进阶项目实战总结笔记
Vulnhub target drone: HARRYPOTTER_ NAGINI
直播系统聊天技术(八):vivo直播系统中IM消息模块的架构实践
成为优秀架构师必备技能:怎样才能画出让所有人赞不绝口的系统架构图?秘诀是什么?快来打开这篇文章看看吧!...
The site is not found after the website is filed. You have not bound this domain name or IP to the corresponding site! The configuration file does not take effect!
2022年MySQL最新面试题
MySql 怎么查出符合条件的最新的数据行?
02 es cluster construction
随机推荐
[供应链·案例篇]石油和天然气行业的数字化转型用例
How can become a good architect necessary skills: painting for all the people praise the system architecture diagram?What is the secret?Quick to open this article and have a look!.
03 gp cluster construction
完全背包问题求组合数和排列数
数字化采购管理系统开发:精细化采购业务流程管理,赋能企业实现“阳光采购”
金仓数据库 KDTS 迁移工具使用指南(2. 简介)
JumpServer堡垒机部署
不需要写代码,快速批量修改文件夹中图片的格式
我的新书销量1万册了!
下载 | 谷歌科学家Kevin P. Murphy发布新书《概率机器学习:高级主题》
史上最全的Redis基础+进阶项目实战总结笔记
助推科技强国高质量发展《科创超级训练营》系列活动正式拉开帷幕
夸克网盘资源站
C # Excel helper classes
LeetCode Week 303
频域分析实践介绍
生物制药产业发展现状和趋势展望
GRUB2的零日漏洞补丁现已推出
DevExpress的GridControl帮助类
创造建材数字转型新视界,中建材如何多边赋能集团业务快速发展