当前位置:网站首页>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>
效果
边栏推荐
猜你喜欢
随机推荐
基于ORB-SLAM2的改进代码
关于MySql中explain结果filtered的理解
MySQL's maximum recommended number of rows is 2000w, is it reliable?
【TDP加码福利】COS用户实践征文月,等你来投稿!!!
【R语言】批量重命名文件
gtk显示4通道rgba图像
史上最全的Redis基础+进阶项目实战总结笔记
金仓数据库 OCCI迁移指南(2. 概述)
My new book has sold 10,000 copies!
网上开户佣金万一靠谱吗,网上开户安全吗
2022 Strong Net Cup CTF---Strong Net Pioneer ASR wp
GTK修改pixmap像素,提取pixmap像素RGB值
直播系统聊天技术(八):vivo直播系统中IM消息模块的架构实践
C#Excel帮助类
RecSys'22|CARCA: Cross-Attention-Aware Context and Attribute Recommendations
极化微波成像概述3
ROS2系列知识(5):【参数】如何管理?
Winform的UI帮助类——部分组件会使用到DevExpress组件
The anxiety of the post-90s was cured by the vegetable market
我在启牛开户安全吗?谁能告诉我开不靠谱?









