HC4*_*ica 4 c# wpf user-interface wpf-controls
请参阅此图片,我将其称为静态框:

我不确定这是不是这个名字.
盒子应该能够容纳任意儿童控制(面板等).
在WPF中,它被称为GroupBox
有关控件,请参阅MSDN文档:
http://msdn.microsoft.com/en-us/library/system.windows.controls.groupbox.aspx
如何使用它
<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<GroupBox Header="Test 1">
<StackPanel Margin="6">
<RadioButton x:Name="option1RadioButton" Content="Option 1" />
<RadioButton x:Name="option2RadioButton" Content="Option 2" />
<RadioButton x:Name="option3RadioButton" Content="Option 3" />
</StackPanel>
</GroupBox>
</Window>
Run Code Online (Sandbox Code Playgroud)
很酷的功能
WPF GroupBox比标准的Win32组框更强大.您可以设置所需的任何类型的内容,例如图像或其他控件,而不仅仅是能够在标题中设置文本:
<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<GroupBox>
<GroupBox.Header>
<StackPanel Orientation="Horizontal">
<Button Content="Test 1" />
<Label Content="Test 2" />
<Button Content="Test 3" />
</StackPanel>
</GroupBox.Header>
<StackPanel Margin="6">
<RadioButton x:Name="option1RadioButton" Content="Option 1" />
<RadioButton x:Name="option2RadioButton" Content="Option 2" />
<RadioButton x:Name="option3RadioButton" Content="Option 3" />
</StackPanel>
</GroupBox>
</Window>
Run Code Online (Sandbox Code Playgroud)

| 归档时间: |
|
| 查看次数: |
186 次 |
| 最近记录: |