Does any body know a nice way to manage the behavior of the scrollviewer inside a PivotItem. While the Scrollviewer contains a Stackpannel with 6 TextBoxes and 6 TextBlockes. (See my code ferder below...)
The way I want it to work: No matter what Textbox I select... It should stay visible and all other textboxes should be reachable while the keybord is shown...
It is no problem if the header of the pivot disappears... But it would be nice if it stay on screan too... I've tried with margins, rectangles with dynamic hights, resizing of the RootFrame, resizing the Pivot, resizing the ViewScroller height... to make the it fit and work... I come close with the resizing actions. But the focus of the TextBox is sometimes behind the keybord.
How to manage to scroll/move the selected TextBox to the top of my screen in this situation...
I hope one of you can help me out...
Here my code of my XAML:
<Grid x:Name="LayoutRoot"
Background="Transparent">
<!--Pivot Control-->
<phone:Pivot Title="MY APPLICATION"
x:Name="PivotRoot">
<phone:PivotItem Header="first"
x:Name="PivotFirst">
<ScrollViewer x:Name="Scroller">
<StackPanel Background="Orange">
<TextBlock Text="hoi" />
<TextBox GotFocus="TextBlock_GotFocus_1"
LostFocus="TextBlock_LostFocus_1"></TextBox>
<TextBlock Text="hoi" />
<TextBox GotFocus="TextBlock_GotFocus_1"
LostFocus="TextBlock_LostFocus_1"></TextBox>
<TextBlock Text="hoi" />
<TextBox GotFocus="TextBlock_GotFocus_1"
LostFocus="TextBlock_LostFocus_1"></TextBox>
<TextBlock Text="hoi" />
<TextBox GotFocus="TextBlock_GotFocus_1"
LostFocus="TextBlock_LostFocus_1"></TextBox>
<TextBlock Text="hoi" />
<TextBox GotFocus="TextBlock_GotFocus_1"
LostFocus="TextBlock_LostFocus_1"></TextBox>
</StackPanel>
</ScrollViewer>
</phone:PivotItem>
</phone:Pivot>
</Grid>
<phone:PhoneApplicationPage.ApplicationBar>
<shell:ApplicationBar x:Name="xxxx"
IsVisible="True"
IsMenuEnabled="True">
<shell:ApplicationBarIconButton x:Name="appBarRegisterButton"
IconUri="/Images/next.png"
Text="Login"
Click="appBarRegisterButton_Click_1"
IsEnabled="True" />
</shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>
Here my codebehind:
private void appBarRegisterButton_Click_1(object sender, EventArgs e)
{ }
private void TextBlock_GotFocus_1(object sender, RoutedEventArgs e)
{ }
private void TextBlock_LostFocus_1(object sender, RoutedEventArgs e)
{ }
Cheers,
K