c# - Keyboard overlaps textbox -


After

I am using a list of boxes for documents that are recorded in a WP8 application.

The number of textboxes is quite large, so users have to scroll between them. To navigate between one field to another, I added the next and last two app badges. Pressing on next will change the focus from the list to the next textbox, and scroll the contents of the scroll viewer with the height of the text box (in this case 50).

However, sometimes, when the element has to switch to focus, the keyboard cover the text box. (Does not scroll content).

Is there a way to apply a text box to go over the keyboard, even if it is in the scroll view?

  & lt; ScrollViewer X: Name = "ContentPanel" Grid.Row = "1" margin = "12,0,12,0" & gt; & Lt; StackPanel & gt; & Lt; TextBlock Text = "{Binding Source = {StaticResource LocalizedStrings}, path = LocalizedResources.STRING_CONTACT}" margin = "10.5" FontWeight = "SemiBold" foreground = "# 878,780" & gt; & Lt; / TextBlock & gt; & Lt; StackPanel margin = "10,5" height = "190" background = "# F4F3F4" & gt; & Lt; Textbox LostFocus = "firstNameTxt_LostFocus_1" GotFocus = "firstNameTxt_GotFocus_1" Margin = "0, -7" FONTSIZE = "23" x: Name = "firstNameTxt" BorderThickness = "0" background = "transparent" InputScope = "PersonalFullName" & gt; & Lt; Text box & gt; & Lt; Textbox LostFocus = "firstNameTxt_LostFocus_1" GotFocus = "firstNameTxt_GotFocus_1" Margin = "0, -7" FONTSIZE = "23" x: Name = "lastNameTxt" BorderThickness = "0" background = "transparent" InputScope = "PersonalFullName" & gt; & Lt; / My: DefaultTextBox & gt; & Lt; Textbox LostFocus = "firstNameTxt_LostFocus_1" GotFocus = "firstNameTxt_GotFocus_1" Margin = "0, -7" FONTSIZE = "23" x: Name = "MobileTxt" BorderThickness = "0" InputScope = "number" background = "transparent" & gt; & Lt; / Text box & gt; & Lt; Textbox LostFocus = "firstNameTxt_LostFocus_1" GotFocus = "firstNameTxt_GotFocus_1" Margin = "0, -7" FONTSIZE = "23" x: Name = "EmailTxt" BorderThickness = "0" background = "transparent" & gt; & Lt; / StackPanel & gt; & Lt; / ScrollViewer & gt;  

Behind Code:

  zero left_Click (object sender, EventArgs e) {int index = this.controls.IndexOf (currentControl) - 1; If (index == -1) {this.Focus (); Return; CurrentControl = this.controls [index]; ContentPanel.ScrollToVerticalOffset (ContentPanel.VerticalOffset - 50); CurrentControl.Focus (); }  itemprop = "text"> 

This is a common issue on WP8.

When a text box is focused, it will translate the application 's rootvijual to bring it to view. It does not work well in some cases (when the clipboard is turned on or in your case). An alternate solution to the desired vertical offset on GotFocus and LostFocus on the TextBox events is done manually RootVisual < / Code> Translating

Private Zero Translation RootVisualY (int yNew) {var Rootframe = App. Current.RootVisual PhoneApplicationFrame; Rootframe.rendertransform = new composite conversion () {translated y = yNew}; }

In your case, you can terminate the automatic translation and scroll down to the desired offset in ScrollViewer in the GotFocus event. Can:

  private zeros firstnameTit_GotFocus_1 (object sender, routing event e) {TranslateRootVisualY (0); Dispatcher.BeginInvoke ((=) = {Double distance offset; //.calculate Destination Offset Content Panel. ScrollToVerticalOffset (destOffset);}); }  

destOffset can be calculated like sender and other functions such as GetRectFromCharacterIndex


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -