如何在windows中获取表单行为,比如设置>>移动网络>> EditAPN。在这个页面中,它在滚动查看器中有许多文本框。当用户点击任何文本框及其get焦点时,页面会向上滚动,页眉保持不变,并显示SIP键盘。当用户从这个文本框中失去焦点时,页面就会进入正常状态,SIP键盘隐藏和报头保持不变。我想要达到这种行为。我找了很多次,但没有找到任何解决办法。在WP7中看到滚动查看器的行为很奇怪。任何帮助都将是伟大的和值得赞赏的。提前谢谢。注意:如果有任何棘手的解决方案,请提供示例代码。
这是我的代码样本。
<Grid x:Name="ContentPanel" Grid.Row="1" >
<ScrollViewer x:Name="Scroller">
<StackPanel Orientation="Vertical">
<TextBlock Text="Name"/>
<TextBox x:Name="txtName" />
<TextBlock Text="Email"/>
<TextBox x:Name="txtEmail"/>
<TextBlock Text="Phone"/>
<TextBox x:Name="txtPhone" />
<TextBlock Text="Adress"/>
<TextBox x:Name="txtAddress" />
</StackPanel>
</ScrollViewer>
</Grid>当我试图向下滚动时,它并没有完全向下移动,似乎是弹性的工作。
编辑:这个例子,我已经看到了,但在我的情况下没有用。我有4个文本框,我的重点是第一个文本框和键盘来隐藏最后一个文本框。如果用户想进入最后一个文本框,并想输入输入,它不会完全滚动和工作弹性。因为这个用户必须按下屏幕的其他部分,然后输入最后一个框。我在“设置”( Settings )的WP7应用程序中看到了->移动网络-> EditAPN。有4-5个文本框和这些完美滚动。不知道MSFT使用的是哪种控制或解决方法。
发布于 2013-02-05 13:11:37
也许我错了,但是为什么不使用一个简单的网格和一个列表选择器控件。您将需要Windows工具包(Nuget 这里)。
网格的第一行包含标题,不会更改。第二行包含您想要的内容(滚动视图、列表选择器、.)
下面是一个非常基本的例子:
<phone:PhoneApplicationPage
x:Class="PhoneApp3.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
SupportedOrientations="Portrait" Orientation="Portrait"
shell:SystemTray.IsVisible="True">
<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!--TitlePanel contains the name of the application and page title-->
<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
<TextBlock x:Name="PageTitle" Text="MY HEADER" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
</StackPanel>
<Grid x:Name="ContentPanel" Grid.Row="1">
<toolkit:ListPicker>
<toolkit:ListPickerItem Content="aaa" />
<toolkit:ListPickerItem Content="bbb" />
<toolkit:ListPickerItem Content="ccc" />
</toolkit:ListPicker>
</Grid>
</Grid>
</phone:PhoneApplicationPage>编辑:
当呈现SIP键盘时,PhoneApplicationFrame.TranslateTransform.Y设置为特定值(横向方向为-259,纵向方向为-339 )。要更新布局,我们只需将上限设置为指定的值(-s),然后Silverlight布局系统将修复这个问题。
这个示例可能对你有帮助。
https://stackoverflow.com/questions/14707496
复制相似问题