Architect's Log

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

GridでLive Messengerの画面構成を再現する

アプリ実行


ソースコード

App.xaml
<Application x:Class="HelloWorld.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="HelloWorld.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="300" Width="300">
    <Grid>
        <Grid.RowDefinitions>
            <!-- 「会話の履歴」が残りのスペースを占有する -->
            <RowDefinition Height="*" />
            <!-- スペースをすべて占有しないように制約する -->
            <RowDefinition Height="Auto" MinHeight="50" MaxHeight="150" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <!-- 「会話の履歴」が残りのスペースを占有する -->
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="Auto"/>
        </Grid.ColumnDefinitions>
        <TextBlock Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" MinWidth="0" Text="こんにちは。" Background="Aqua" />
        <TextBox Grid.Row="1" MinWidth="0" Text="ひさしぶり。" Background="Pink" />
        <Button Grid.Row="1" Grid.Column="1" MinWidth="0">送信</Button>
    </Grid>
</Window>