WPF 窗體佈局
C/S WPF (簡介,案例,原始碼,截圖)
WPF佈局簡介:
wpf中如果不進行控制元件佈局的設定,我們做出的應用調整視窗大小以後不能隨窗體的大小而變化。
WPF佈局案例:
TextBox---隨窗體的變化而變化,佈局---兩行兩列
原始碼:
<Window x:Class="OscarSystemV2012.Views.CustomerSystem.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300">
<Grid>
<
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBox Grid.Row="0" Grid.Column="0" Background="Yellow"></TextBox>
<TextBox Grid.Row="0" Grid.Column="1" Background="Yellow"></TextBox>
<TextBoxGrid.Row="1" Grid.Column="0" Background="Yellow"></TextBox>
<TextBox Grid.Row="1" Grid.Column="1" Background="Yellow"></TextBox>
</Grid>
</Window>
截圖: