[UWP] App:网格不适合屏幕,底部切断 [英] [UWP] App: Grid does not fit the screen, bottom cut off
问题描述
大家好,
我希望我的网格的整个内容都适合屏幕,但无论我尝试什么,底部都会被切断。查看截图。我也附上了XAML代码。它有点大,但实际上它只是顶部,底部,右边的4个相同的框
和左边,塞进一个网格,它本身就在一个简单的两排网格内(标题的顶行和第二个是实际内容。)
I want the entire content of my grid to fit on the screen, but no matter what I try, the bottom gets cut off. See the screenshot. I am also attaching the XAML code. It is a little big but really it is just the 4 identical boxes at the top, bottom, right and left, crammed into a grid, which itself is inside a simple two-row grid (top row for the title and the 2nd for the actual content.)
这是一个Raspberry Pi应用程序。我使用Windows IoT删除客户端来查看它。附加的screeenshot。提前感谢您的建议。
This is a Raspberry Pi application. I use Windows IoT Remove Client to view it. The screeenshot of that is attached. Thanks in advance for your advice.
<Page
x:Class="RCR.CalibrationCenterPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:RCR"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Page.Resources>
<Style x:Key="TextBoxStyle" TargetType="TextBox">
<Setter Property="Margin" Value="2"/>
<Setter Property="Background" Value="White"/>
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
<Style x:Key="TextBlockStyle" TargetType="TextBlock">
<Setter Property="Margin" Value="2"/>
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
<Style x:Key="ComboBoxStyle" TargetType="ComboBox">
<Setter Property="Background" Value="White"/>
<Setter Property="Margin" Value="2"/>
</Style>
</Page.Resources>
<!-- outer-most grid -->
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Border Grid.Column="0" Grid.Row="0" Background="Blue">
<TextBlock Text="Servo Calibration Center" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- center image -->
<Grid Grid.Row="1" Grid.Column="0" Margin="3">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Border Background="DarkBlue" HorizontalAlignment="Stretch" Grid.ColumnSpan="3" />
<Border HorizontalAlignment="Stretch" Grid.Row="1" Grid.ColumnSpan="3" Grid.RowSpan="2" BorderThickness="1 1 1 1" Background="#FFFFE0" BorderBrush="Black"/>
<Border HorizontalAlignment="Stretch" Grid.Row="3" Grid.ColumnSpan="3" Grid.RowSpan="2" BorderThickness="1 0 1 1" Background="#E0FFFF" BorderBrush="Black"/>
<TextBlock Text="Arm 2" Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="3" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White"/>
<TextBlock Text="Linear Channel:" Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="2" Style="{StaticResource TextBlockStyle}"/>
<ComboBox x:Name="Arm2LinearPin" Grid.Column="3" Grid.Row="1" HorizontalAlignment="Stretch" Style="{StaticResource ComboBoxStyle}">
<ComboBoxItem>0</ComboBoxItem>
<ComboBoxItem>1</ComboBoxItem>
<ComboBoxItem>2</ComboBoxItem>
<ComboBoxItem>3</ComboBoxItem>
<ComboBoxItem>4</ComboBoxItem>
<ComboBoxItem>5</ComboBoxItem>
<ComboBoxItem>6</ComboBoxItem>
<ComboBoxItem>7</ComboBoxItem>
<ComboBoxItem>8</ComboBoxItem>
<ComboBoxItem>9</ComboBoxItem>
<ComboBoxItem>10</ComboBoxItem>
<ComboBoxItem>11</ComboBoxItem>
</ComboBox>
<TextBlock Text="Near/Far" Grid.Column="0" Grid.Row="2" Style="{StaticResource TextBlockStyle}"/>
<TextBox x:Name="Arm2LinearNearValue" Grid.Column="1" Grid.Row="2" Style="{StaticResource TextBoxStyle}"/>
<TextBox x:Name="Arm2LinearFarValue" Grid.Column="2" Grid.Row="2" Style="{StaticResource TextBoxStyle}"/>
<TextBlock Text="Gripper Channel:" Grid.Column="0" Grid.Row="3" Grid.ColumnSpan="2" Style="{StaticResource TextBlockStyle}"/>
<ComboBox x:Name="Arm2TurnPin" Grid.Column="2" Grid.Row="3" HorizontalAlignment="Stretch" Style="{StaticResource ComboBoxStyle}">
<ComboBoxItem>0</ComboBoxItem>
<ComboBoxItem>1</ComboBoxItem>
<ComboBoxItem>2</ComboBoxItem>
<ComboBoxItem>3</ComboBoxItem>
<ComboBoxItem>4</ComboBoxItem>
<ComboBoxItem>5</ComboBoxItem>
<ComboBoxItem>6</ComboBoxItem>
<ComboBoxItem>7</ComboBoxItem>
<ComboBoxItem>8</ComboBoxItem>
<ComboBoxItem>9</ComboBoxItem>
<ComboBoxItem>10</ComboBoxItem>
<ComboBoxItem>11</ComboBoxItem>
</ComboBox>
<TextBlock Text="0º / 90º" Grid.Column="0" Grid.Row="4" Style="{StaticResource TextBlockStyle}"/>
<TextBox x:Name="Arm2TurnNeutralValue" Grid.Column="1" Grid.Row="4" Style="{StaticResource TextBoxStyle}"/>
<TextBox x:Name="Arm2TurnRightValue" Grid.Column="2" Grid.Row="4" Style="{StaticResource TextBoxStyle}"/>
</Grid>
<Grid Grid.Row="0" Grid.Column="1" Margin="3">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Border Background="DarkBlue" HorizontalAlignment="Stretch" Grid.ColumnSpan="3" />
<Border HorizontalAlignment="Stretch" Grid.Row="1" Grid.ColumnSpan="3" Grid.RowSpan="2" BorderThickness="1 1 1 1" Background="#FFFFE0" BorderBrush="Black"/>
<Border HorizontalAlignment="Stretch" Grid.Row="3" Grid.ColumnSpan="3" Grid.RowSpan="2" BorderThickness="1 0 1 1" Background="#E0FFFF" BorderBrush="Black"/>
<TextBlock Text="Arm 1" Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="3" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White"/>
<TextBlock Text="Linear Channel:" Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="2" Style="{StaticResource TextBlockStyle}"/>
<ComboBox x:Name="Arm1LinearPin" Grid.Column="3" Grid.Row="1" HorizontalAlignment="Stretch" Style="{StaticResource ComboBoxStyle}">
<ComboBoxItem>0</ComboBoxItem>
<ComboBoxItem>1</ComboBoxItem>
<ComboBoxItem>2</ComboBoxItem>
<ComboBoxItem>3</ComboBoxItem>
<ComboBoxItem>4</ComboBoxItem>
<ComboBoxItem>5</ComboBoxItem>
<ComboBoxItem>6</ComboBoxItem>
<ComboBoxItem>7</ComboBoxItem>
<ComboBoxItem>8</ComboBoxItem>
<ComboBoxItem>9</ComboBoxItem>
<ComboBoxItem>10</ComboBoxItem>
<ComboBoxItem>11</ComboBoxItem>
</ComboBox>
<TextBlock Text="Near/Far" Grid.Column="0" Grid.Row="2" Style="{StaticResource TextBlockStyle}"/>
<TextBox x:Name="Arm1LinearNearValue" Grid.Column="1" Grid.Row="2" Style="{StaticResource TextBoxStyle}"/>
<TextBox x:Name="Arm1LinearFarValue" Grid.Column="2" Grid.Row="2" Style="{StaticResource TextBoxStyle}"/>
<TextBlock Text="Gripper Channel:" Grid.Column="0" Grid.Row="3" Grid.ColumnSpan="2" Style="{StaticResource TextBlockStyle}"/>
<ComboBox x:Name="Arm1TurnPin" Grid.Column="2" Grid.Row="3" HorizontalAlignment="Stretch" Style="{StaticResource ComboBoxStyle}">
<ComboBoxItem>0</ComboBoxItem>
<ComboBoxItem>1</ComboBoxItem>
<ComboBoxItem>2</ComboBoxItem>
<ComboBoxItem>3</ComboBoxItem>
<ComboBoxItem>4</ComboBoxItem>
<ComboBoxItem>5</ComboBoxItem>
<ComboBoxItem>6</ComboBoxItem>
<ComboBoxItem>7</ComboBoxItem>
<ComboBoxItem>8</ComboBoxItem>
<ComboBoxItem>9</ComboBoxItem>
<ComboBoxItem>10</ComboBoxItem>
<ComboBoxItem>11</ComboBoxItem>
</ComboBox>
<TextBlock Text="0º / 90º" Grid.Column="0" Grid.Row="4" Style="{StaticResource TextBlockStyle}"/>
<TextBox x:Name="Arm1TurnNeutralValue" Grid.Column="1" Grid.Row="4" Style="{StaticResource TextBoxStyle}"/>
<TextBox x:Name="Arm1TurnRightValue" Grid.Column="2" Grid.Row="4" Style="{StaticResource TextBoxStyle}"/>
</Grid>
<Grid Grid.Row="1" Grid.Column="2" Margin="3">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Border Background="DarkBlue" HorizontalAlignment="Stretch" Grid.ColumnSpan="3" />
<Border HorizontalAlignment="Stretch" Grid.Row="1" Grid.ColumnSpan="3" Grid.RowSpan="2" BorderThickness="1 1 1 1" Background="#FFFFE0" BorderBrush="Black"/>
<Border HorizontalAlignment="Stretch" Grid.Row="3" Grid.ColumnSpan="3" Grid.RowSpan="2" BorderThickness="1 0 1 1" Background="#E0FFFF" BorderBrush="Black"/>
<TextBlock Text="Arm 0" Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="3" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White"/>
<TextBlock Text="Linear Channel:" Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="2" Style="{StaticResource TextBlockStyle}"/>
<ComboBox x:Name="Arm0LinearPin" Grid.Column="3" Grid.Row="1" HorizontalAlignment="Stretch" Style="{StaticResource ComboBoxStyle}">
<ComboBoxItem>0</ComboBoxItem>
<ComboBoxItem>1</ComboBoxItem>
<ComboBoxItem>2</ComboBoxItem>
<ComboBoxItem>3</ComboBoxItem>
<ComboBoxItem>4</ComboBoxItem>
<ComboBoxItem>5</ComboBoxItem>
<ComboBoxItem>6</ComboBoxItem>
<ComboBoxItem>7</ComboBoxItem>
<ComboBoxItem>8</ComboBoxItem>
<ComboBoxItem>9</ComboBoxItem>
<ComboBoxItem>10</ComboBoxItem>
<ComboBoxItem>11</ComboBoxItem>
</ComboBox>
<TextBlock Text="Near/Far" Grid.Column="0" Grid.Row="2" Style="{StaticResource TextBlockStyle}"/>
<TextBox x:Name="Arm0LinearNearValue" Grid.Column="1" Grid.Row="2" Style="{StaticResource TextBoxStyle}"/>
<TextBox x:Name="Arm0LinearFarValue" Grid.Column="2" Grid.Row="2" Style="{StaticResource TextBoxStyle}"/>
<TextBlock Text="Gripper Channel:" Grid.Column="0" Grid.Row="3" Grid.ColumnSpan="2" Style="{StaticResource TextBlockStyle}"/>
<ComboBox x:Name="Arm0TurnPin" Grid.Column="2" Grid.Row="3" HorizontalAlignment="Stretch" Style="{StaticResource ComboBoxStyle}">
<ComboBoxItem>0</ComboBoxItem>
<ComboBoxItem>1</ComboBoxItem>
<ComboBoxItem>2</ComboBoxItem>
<ComboBoxItem>3</ComboBoxItem>
<ComboBoxItem>4</ComboBoxItem>
<ComboBoxItem>5</ComboBoxItem>
<ComboBoxItem>6</ComboBoxItem>
<ComboBoxItem>7</ComboBoxItem>
<ComboBoxItem>8</ComboBoxItem>
<ComboBoxItem>9</ComboBoxItem>
<ComboBoxItem>10</ComboBoxItem>
<ComboBoxItem>11</ComboBoxItem>
</ComboBox>
<TextBlock Text="0º / 90º" Grid.Column="0" Grid.Row="4" Style="{StaticResource TextBlockStyle}"/>
<TextBox x:Name="Arm0TurnNeutralValue" Grid.Column="1" Grid.Row="4" Style="{StaticResource TextBoxStyle}"/>
<TextBox x:Name="Arm0TurnRightValue" Grid.Column="2" Grid.Row="4" Style="{StaticResource TextBoxStyle}"/>
</Grid>
<Grid Grid.Row="2" Grid.Column="1" Margin="3">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Border Background="DarkBlue" HorizontalAlignment="Stretch" Grid.ColumnSpan="3" />
<Border HorizontalAlignment="Stretch" Grid.Row="1" Grid.ColumnSpan="3" Grid.RowSpan="2" BorderThickness="1 1 1 1" Background="#FFFFE0" BorderBrush="Black"/>
<Border HorizontalAlignment="Stretch" Grid.Row="3" Grid.ColumnSpan="3" Grid.RowSpan="2" BorderThickness="1 0 1 1" Background="#E0FFFF" BorderBrush="Black"/>
<TextBlock Text="Arm 3" Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="3" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White"/>
<TextBlock Text="Linear Channel:" Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="2" Style="{StaticResource TextBlockStyle}"/>
<ComboBox x:Name="Arm3LinearPin" Grid.Column="3" Grid.Row="1" HorizontalAlignment="Stretch" Style="{StaticResource ComboBoxStyle}">
<ComboBoxItem>0</ComboBoxItem>
<ComboBoxItem>1</ComboBoxItem>
<ComboBoxItem>2</ComboBoxItem>
<ComboBoxItem>3</ComboBoxItem>
<ComboBoxItem>4</ComboBoxItem>
<ComboBoxItem>5</ComboBoxItem>
<ComboBoxItem>6</ComboBoxItem>
<ComboBoxItem>7</ComboBoxItem>
<ComboBoxItem>8</ComboBoxItem>
<ComboBoxItem>9</ComboBoxItem>
<ComboBoxItem>10</ComboBoxItem>
<ComboBoxItem>11</ComboBoxItem>
</ComboBox>
<TextBlock Text="Near/Far" Grid.Column="0" Grid.Row="2" Style="{StaticResource TextBlockStyle}"/>
<TextBox x:Name="Arm3LinearNearValue" Grid.Column="1" Grid.Row="2" Style="{StaticResource TextBoxStyle}"/>
<TextBox x:Name="Arm3LinearFarValue" Grid.Column="2" Grid.Row="2" Style="{StaticResource TextBoxStyle}"/>
<TextBlock Text="Gripper Channel:" Grid.Column="0" Grid.Row="3" Grid.ColumnSpan="2" Style="{StaticResource TextBlockStyle}"/>
<ComboBox x:Name="Arm3TurnPin" Grid.Column="2" Grid.Row="3" HorizontalAlignment="Stretch" Style="{StaticResource ComboBoxStyle}">
<ComboBoxItem>0</ComboBoxItem>
<ComboBoxItem>1</ComboBoxItem>
<ComboBoxItem>2</ComboBoxItem>
<ComboBoxItem>3</ComboBoxItem>
<ComboBoxItem>4</ComboBoxItem>
<ComboBoxItem>5</ComboBoxItem>
<ComboBoxItem>6</ComboBoxItem>
<ComboBoxItem>7</ComboBoxItem>
<ComboBoxItem>8</ComboBoxItem>
<ComboBoxItem>9</ComboBoxItem>
<ComboBoxItem>10</ComboBoxItem>
<ComboBoxItem>11</ComboBoxItem>
</ComboBox>
<TextBlock Text="0º / 90º" Grid.Column="0" Grid.Row="4" Style="{StaticResource TextBlockStyle}"/>
<TextBox x:Name="Arm3TurnNeutralValue" Grid.Column="1" Grid.Row="4" Style="{StaticResource TextBoxStyle}"/>
<TextBox x:Name="Arm3TurnRightValue" Grid.Column="2" Grid.Row="4" Style="{StaticResource TextBoxStyle}"/>
</Grid>
</Grid>
</Grid>
</Page>
推荐答案
您好,
对于最外层网格,您应该将行高从Auto更改为*。并且对于第二个网格设置三个行高度从自动到*。
You should change Row Height from Auto to * for outer most Grid . And also for second Grid set three Rows height from Auto to * .
这篇关于[UWP] App:网格不适合屏幕,底部切断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!