UWP中XAML布局
1 <Page 2 x:Class="RandomCipher.MainPage" 3 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 4 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 5 xmlns:local="using:RandomCipher" 6 xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 7 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 8 mc:Ignorable="d"> 9 10 11 <Page.Resources> 12 <Style TargetType="Button"> 13 <Setter Property="Margin" Value="5"/> 14 <Setter Property="FontSize" Value="22"/> 15 <Setter Property="VerticalAlignment" Value="Stretch"/> 16 <Setter Property="HorizontalAlignment" Value="Stretch"/> 17 </Style> 18 </Page.Resources> 19 <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" Padding="3"> 20 <Grid.RowDefinitions> 21 <RowDefinition Height="auto"/> 22 <RowDefinition Height="auto"/> 23 <RowDefinition Height="auto"/> 24 <RowDefinition Height="*"/> 25 <RowDefinition Height="5"/> 26 27 </Grid.RowDefinitions> 28 <Grid.ColumnDefinitions> 29 <ColumnDefinition Width="3*"/> 30 <ColumnDefinition Width="3*"/> 31 <ColumnDefinition Width="3*"/> 32 <ColumnDefinition Width="1*"/> 33 </Grid.ColumnDefinitions> 34 35 <Grid Grid.Row="0" Grid.ColumnSpan="2" > 36 <TextBlock x:Name="textBlock" Text="随机密码:" FontSize="22" HorizontalAlignment="Left" VerticalAlignment="Top"></TextBlock> 37 </Grid> 38 <Grid Grid.Row="1" Grid.ColumnSpan="3" Padding="22"> 39 <TextBlock x:Name="newtextBlock" Text="" FontSize="40" HorizontalAlignment="Right"></TextBlock> 40 </Grid> 41 <Grid Grid.Row="3" Grid.Column="2" VerticalAlignment="Bottom"> 42 <Button x:Name="newButton" Content="生成" FontSize="25" Click="newButton_Click"></Button> 43 </Grid> 44 45 46 <StackPanel Grid.Row="2" Grid.ColumnSpan="3" Orientation="Horizontal"> 47 <RadioButton x:Name="six_RadioButton" GroupName="NumberLen" Content="六位" Checked="six_RadioButton_Checked" /> 48 <RadioButton x:Name="eight_RadioButton" GroupName="NumberLen" Content="八位" Checked="eight_RadioButton_Checked"/> 49 <RadioButton x:Name="ten_RadioButton" GroupName="NumberLen" Content="十位" Checked="ten_RadioButton_Checked" /> 50 51 </StackPanel> 52 <StackPanel Grid.Row="3" Grid.Column="0" Orientation="Vertical" VerticalAlignment="Bottom"> 53 <CheckBox x:Name="number_checkBox" Content="数字" Checked="number_checkBox_Checked" /> 54 <CheckBox x:Name="upperCase_checkBox" Content="大写字母" Checked="upperCase_checkBox_Checked" /> 55 <CheckBox x:Name="lowerCase_checkBox" Content="小写字母" Checked="lowerCase_checkBox_Checked" /> 56 <CheckBox x:Name="specialChar_checkBox" Content="特殊字符" Checked="specialChar_checkBox_Checked" /> 57 </StackPanel> 58 <Button x:Name="copy_Button" Content="Copy" Grid.Column="1" HorizontalAlignment="Left" Margin="105.667,248.333,0,0" Grid.Row="3" VerticalAlignment="Top" Width="100" Grid.ColumnSpan="2" Click="copy_Button_Click"/> 62 </Grid> 63 </Page>