删除边距按钮 ContentDialog Windows 10 Mobile - XAML

Remove Margin Button ContentDialog Windows 10 Mobile - XAML

在我的 ContentDialog 中。聚焦任何元素,键入 TextBox,键盘出现。当键盘出现时,上面有很大的边距(可能是 20-30 像素)。此 space 与分配给主按钮和辅助按钮的 space 高度相同。如果有这个边距,我的内容有一个滚动条,我不想要它。我有 space 足以显示我的对话框的所有内容,如果删除这个 margin/padding 当然。

该主题与以下内容相关:

<StackPanel Orientation="Horizontal">


             <TextBox x:Name="txtUser" IsSpellCheckEnabled="False"
             Background="Black" Foreground="Red  BorderBrush="Red" BorderThickness="1"
             PlaceholderText="Digit your username"
             GotFocus="txtUser_GotFocus" Style="{StaticResource TextBoxStyle}" 
             TextChanged="txtUser_TextChanged"
             />

            <Button x:Name="MakeOff" 
            Height="32" BorderThickness="1" 
            HorizontalAlignment="Center"
            Foreground="Red" Background="Black"
            Style="{StaticResource ButtonStyle}"
            Margin="0">

            <HyperlinkButton
            Height="32" BorderThickness="1" 
            HorizontalAlignment="Center"
            Foreground="Red" Background="Black"
            Margin="0"
            NavigateUri="www.google.pt"
            Style="{StaticResource HyperLinkButtonStyleMobile}"
            Content="Register">
                <HyperlinkButton.ContentTemplate>
                    <DataTemplate>
                    <TextBlock Text="{Binding}" />
                    </DataTemplate>
                </HyperlinkButton.ContentTemplate>
            </HyperlinkButton>

            <Button 
            Height="32" BorderThickness="1" 
            HorizontalAlignment="Center"
            Foreground="Red" Background="Black"
            Style="{StaticResource ButtonStyle}"
            Margin="0">

            <HyperlinkButton x:Name="btnRegisterTwo"
            Height="32" BorderThickness="1" 
            HorizontalAlignment="Center"
            Foreground="Red" Background="Black"
            Margin="0"
            NavigateUri="www.google.pt"
            Style="{StaticResource HyperLinkButtonStyleMobile}"
            Content="Register">
                <HyperlinkButton.ContentTemplate>
                    <DataTemplate>
                    <TextBlock Text="{Binding}" />
                    </DataTemplate>
                </HyperlinkButton.ContentTemplate>
            </HyperlinkButton>

          <Button x:Name="MakeOffThree" 
            Height="32" BorderThickness="1" 
            HorizontalAlignment="Center"
            Foreground="Red" Background="Black"
            Style="{StaticResource ButtonStyle}"
            Margin="0">
          </StackPanel>
      </Grid>

有人帮忙删除这个吗?

谢谢

有趣的是,样式中的 ContentScrollViewer 在 运行 期间被赋予了固定的高度,一个 hack 是从 ScrollViewer 中删除这个 x:Name

<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Disabled" ZoomMode="Disabled" Margin="{ThemeResource ContentDialogContentScrollViewerMargin}" IsTabStop="False">

此外,您需要将 RowDefinitions 添加回样式中的根面板 LayoutRoot

<Grid x:Name="LayoutRoot">
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
    </Grid.RowDefinitions>