删除保证金按钮ContentDialog Windows 10 Mobile - XAML

时间:2015-09-16 17:32:14

标签: c# xaml dialog margins windows-10-mobile

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

本主题与:ContentDialog Windows 10 Mobile XAML - FullScreen - 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>

有人帮忙删除了吗?

由于

1 个答案:

答案 0 :(得分:1)

有趣的是,样式中的ContentScrollViewer在运行时被赋予固定的高度,而hack则是从x:Name中删除此ScrollViewer

<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>