windows phone 8 scrollviewer隐藏了我的按钮

时间:2013-07-29 12:34:42

标签: windows-phone-7 windows-phone-8

我编写了一个代码来显示一些输入框和一个连接按钮。但是当我在输入框中输入值时,它会隐藏我的连接按钮,我会尝试滚动它反弹回来? 可能是这个问题的根源是什么?

<ScrollViewer>
    <Grid x:Name="LayoutRoot" Background="{StaticResource PhoneChromeBrush}">

            <StackPanel Grid.Row="0">
                <TextBlock Text="" ></TextBlock>
                <TextBlock Text="{Binding Path=LocalizedResources.LoginPromptSignInText, Source={StaticResource LocalizedStrings}}"  FontSize="30"></TextBlock>
                <TextBlock Text="" ></TextBlock>
                <TextBlock Text="{Binding Path=LocalizedResources.UsernameText, Source={StaticResource LocalizedStrings}}" ></TextBlock>
                <TextBox x:Name="TextBlockUserName" ></TextBox>
                <TextBlock Text="{Binding Path=LocalizedResources.PasswordText, Source={StaticResource LocalizedStrings}}" ></TextBlock>
                <StackPanel x:Name="PasswordPanel"/>
                <CheckBox x:Name="CheckBoxShowPassword" Click="ShowPassword" Content="{Binding Path=LocalizedResources.LoginPromptShowPasswordText, Source={StaticResource LocalizedStrings}}"></CheckBox>
                <TextBlock Text="{Binding Path=LocalizedResources.LoginPromptDomainText, Source={StaticResource LocalizedStrings}}"></TextBlock>
                <TextBox x:Name="tbDomain" ></TextBox>

                <Grid >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition></ColumnDefinition>
                        <ColumnDefinition></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button x:Name="ButtonExit" Content="{Binding Path=LocalizedResources.LoginPromptExitButtonText, Source={StaticResource LocalizedStrings}}" Grid.Row="2" Grid.Column="0" ></Button>
                    <Button x:Name="ButtonConnect" Content="{Binding Path=LocalizedResources.LoginPromptConnectButtonText, Source={StaticResource LocalizedStrings}}" Grid.Row="2" Grid.Column="1" ></Button>
                </Grid>
            </StackPanel>
    </Grid>
    </ScrollViewer>

enter image description here

2 个答案:

答案 0 :(得分:0)

您可以使用ListBox而不是滚动查看器,也可以尝试调整ScrollViewer的Height属性。

答案 1 :(得分:0)

我建议您使用ApplicationBar作为按钮。键盘显示在ApplicationBar上方,因此按钮始终可见。

<Grid x:Name="LayoutRoot" Background="{StaticResource PhoneChromeBrush}">
    <ScrollViewer>
            <StackPanel>
                <TextBlock Text="" ></TextBlock>
                <TextBlock Text="Sign In"  FontSize="30"/>
                <TextBlock Text="" ></TextBlock>
                <TextBlock Text="Username" />
                <TextBox x:Name="TextBlockUserName" />
                <TextBlock Text="Password" TextTrimming="WordEllipsis" />
                <TextBox x:Name="TextBlockPassword" />
                <StackPanel x:Name="PasswordPanel"/>
                <CheckBox x:Name="CheckBoxShowPassword" Content="ShowPassword"></CheckBox>
                <TextBlock Text="Domain"/>
                <TextBox x:Name="tbDomain"/>
            </StackPanel>
    </ScrollViewer>
</Grid>
<phone:PhoneApplicationPage.ApplicationBar>
    <shell:ApplicationBar>
        <shell:ApplicationBarIconButton Text="connect" IconUri="Assets\done.png" Click="OnConnectButtonClick"/>
        <shell:ApplicationBarIconButton Text="cancel" IconUri="Assets\cancel.png" Click="OnCancelButtonClick"/>
    </shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>