最終更新:2020-04-06 (月) 10:16:40 (1474d)  

System.Windows.Controls.Grid
Top / System.Windows.Controls.Grid

列と行で構成される柔軟なグリッド領域を定義します。

https://docs.microsoft.com/ja-jp/dotnet/api/system.windows.controls.grid?view=netframework-4.8

メモ

  • HTMLのレイアウトで例えるならばtableタグ?に相当するパネル

メモ

  • Windowの上にButton1が全体に置かれてその上にButton2が全体に置かれる。
    <Window x:Class="WpfApplication1.MainWindow"
            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:WpfApplication1"
            mc:Ignorable="d"
            Title="MainWindow" Height="350" Width="525">
        <Grid>
            <Button Content="Button1"/>
            <Button Content="Button2"/>
        </Grid> 
    </Window>

プロパティ

比率

  • Height="2*" - 他の要素の2倍

メモ

  • Grid コントロール内でコントロールを配置した場合、特に指定しない限りそのコントロールは 1 行 1 列の位置に配置されます

Grid内のコントロールの配置

関連