Architect's Log

I'm a Cloud Architect. I'm highly motivated to reduce toils with driving DevOps.

コンテナコントロールを使用する

エッセンシャル WPF P.131より引用

ユーザーインターフェースの一部をグループ化したり隠したりするために、WPFには3つの主要な組み込みコントロールがあります。それは、TabControl、Expander、およびGroupBoxです。

アプリ実行


ソースコード

App.xaml
<Application x:Class="WpfApplication2.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             StartupUri="MainWindow.xaml">
</Application>
MainWindow.xaml
<Window x:Class="WpfApplication2.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="800">
    <Grid>
        <TabControl>
            <TabItem Header="プロジェクトおよびソリューション">
            </TabItem>
            <TabItem Header="環境">
                <StackPanel>
                    <Expander Header="全般" IsExpanded="True">
                        <GroupBox Header="視覚的効果">
                            <Label>コンテンツ</Label>
                        </GroupBox>
                    </Expander>
                    <Expander Header="Webブラウザー">
                        <GroupBox Header="ホームページ">
                            <Label>コンテンツ</Label>
                        </GroupBox>
                    </Expander>
                </StackPanel>            
            </TabItem>
        </TabControl>
    </Grid>
</Window>