2014-10-31 2 views
0

Windows 전화 키보드 표시 방법을 구성하는 방법이 있습니까? 각 항목에 TextBox가있는 listview가 있습니다.Windows 전화 키보드 표시

TextBox를 클릭하면 키보드가 표시되고 키보드가 나타나는 텍스트 상자가 팝업되어 키보드 상단에 고정됩니다.

예를 들어 목록 끝에 두 번째 마지막 텍스트 상자를 클릭하면 키보드가 팝업되면 마지막 두 번째 TextBox가 키보드 상단에 고정되고 키보드는 마지막 텍스트 상자를 덮습니다.

어쨌든이 동작을 변경하려면 어떻게해야합니까?

답변

0
**XAML** 

    <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="24,0,0,0"> 
      <TextBlock x:Name="PageTitle" Text="sign in" Margin="0,0,0,0" Height="125" Style="{StaticResource PhoneTextTitle1Style}" Tap="PageTitle_Tap"/> 
     </StackPanel> 

     <ScrollViewer Grid.Row="1" x:Name="Scroller" VerticalAlignment="Top"> 
      <Grid x:Name="ContentPanel" Grid.Row="1"> 
       <Grid.RowDefinitions> 
        <RowDefinition Height="Auto"/> 
        <RowDefinition Height="Auto"/> 
        <RowDefinition Height="Auto"/> 
        <RowDefinition Height="Auto"/> 
        <RowDefinition Height="Auto"/> 
        <RowDefinition Height="Auto"/> 
        <RowDefinition Height="Auto"/> 
        <RowDefinition Height="Auto"/> 
       </Grid.RowDefinitions> 

       <TextBlock Grid.Row="0" Name="EnterUserIdTitle" Margin="24,0,14,6" FontSize="26" Text="Username"/> 
       <TextBox Grid.Row="1" Name="EnterUserIdInput" Margin="12,0,24,6" Text="" GotFocus="EnterUserIdInput_GotFocus" LostFocus="UserIdLostFocus" /> 

       <TextBlock Grid.Row="2" Name="EnterPwdTitle" Margin="24,0,14,6" FontSize="26" Text="Password"/> 
       <PasswordBox Grid.Row="3" Name="EnterPwdInput" Margin="12,0,24,6" GotFocus="EnterPwdInput_GotFocus" LostFocus="EnterPwdInput_LostFocus"/> 

       <TextBlock Grid.Row="4" Name="ServerUrlTitle" Margin="24,10,24,6" FontSize="26" Text="namespace"/> 
       <TextBox Grid.Row="5" Name="ServerUrlInput" Margin="12,0,24,6" Text="" TextWrapping="Wrap" GotFocus="ServerUrlInput_GotFocus" LostFocus="ServerUrlInput_LostFocus"/> 
       <Grid Grid.Row="6" Name="DebugEndPointGrid"> 
        <Grid.RowDefinitions> 
         <RowDefinition Height="Auto"/> 
         <RowDefinition Height="Auto"/> 
        </Grid.RowDefinitions> 

        <TextBlock Grid.Row="0" Name="DebugEndpointTitle" Margin="24,10,24,6" FontSize="26" Text="End Point"/> 
        <TextBox Grid.Row="1" Name="DebugEndpoint" Height="72" Margin="12,0,24,6" GotFocus="DebugEndpoint_GotFocus" LostFocus="DebugEndpoint_LostFocus" /> 
       </Grid> 
       <CheckBox Grid.Row="7" Name="RemeberCheckbox" Margin="12,0,24,6" Content="Remember Me" IsChecked="True"/> 

      </Grid> 
     </ScrollViewer> 
    </Grid> 


---------- 
**C#** 

    public partial class MainPage : PhoneApplicationPage 
    { 
     public const string SettingsPageUri = @"/SettingsPage.xaml"; 

     private double DefaultScrollerHeight; 
     private int SIPVisibleScrollerHeight = 250; 
     private int UserIDOffset = 0; 
     private int PasswordOffset = 110; 
     private int ServiceUrlOffset = 250; 
     private int DebugOffset = 300; 
     // Constructor 
     public MainPage() 
     { 
      InitializeComponent(); 

      this.Loaded += new RoutedEventHandler(SettingsPage_Loaded); 
     } 

     private void SettingsPage_Loaded(object sender, RoutedEventArgs e) 
     { 
      // Code to avoid screen from pushing upward on launch of SIP and provides options to resize the scroller and remove elastic effect from forms by enabling scrollers when SIP is activated. 
      // Header also does not push up when textbox gets focus. 
      //(App.Current as App).RootFrame.RenderTransform = new CompositeTransform(); 

      DefaultScrollerHeight = this.Scroller.Height; 

      EnterUserIdInput.Tag = false; 
      EnterPwdInput.Tag = false; 
      ServerUrlInput.Tag = false; 
      DebugEndpoint.Tag = false; 
     } 

     private void EnterUserIdInput_GotFocus(object sender, RoutedEventArgs e) 
     { 
      EnterUserIdInput.Tag = true; 
      if (this.Scroller.Height != SIPVisibleScrollerHeight) 
      { 
       this.Scroller.Height = SIPVisibleScrollerHeight; 
       this.Scroller.UpdateLayout(); 
       this.Scroller.ScrollToVerticalOffset(UserIDOffset); 
      } 
     } 

     private void UserIdLostFocus(object sender, RoutedEventArgs e) 
     { 
      EnterUserIdInput.Tag = false; 
     } 

     private void EnterPwdInput_GotFocus(object sender, RoutedEventArgs e) 
     { 
      EnterPwdInput.Tag = true; 

      if (this.Scroller.Height != SIPVisibleScrollerHeight) 
      { 
       this.Scroller.Height = SIPVisibleScrollerHeight; 
       this.Scroller.UpdateLayout(); 
       this.Scroller.ScrollToVerticalOffset(PasswordOffset); 
      } 
     } 

     private void EnterPwdInput_LostFocus(object sender, RoutedEventArgs e) 
     { 
      EnterPwdInput.Tag = false; 
     } 

     private void ServerUrlInput_GotFocus(object sender, RoutedEventArgs e) 
     { 
      ServerUrlInput.Tag = true; 

      if (this.Scroller.Height != SIPVisibleScrollerHeight) 
      { 
       this.Scroller.Height = SIPVisibleScrollerHeight; 
       this.Scroller.UpdateLayout(); 
       this.Scroller.ScrollToVerticalOffset(ServiceUrlOffset); 
      } 
     } 

     private void ServerUrlInput_LostFocus(object sender, RoutedEventArgs e) 
     { 
      ServerUrlInput.Tag = false; 
     } 

     private void DebugEndpoint_GotFocus(object sender, RoutedEventArgs e) 
     { 
      DebugEndpoint.Tag = true; 

      if (this.Scroller.Height != SIPVisibleScrollerHeight) 
      { 
       this.Scroller.Height = SIPVisibleScrollerHeight; 
       this.Scroller.UpdateLayout(); 
       this.Scroller.ScrollToVerticalOffset(DebugOffset); 
      } 
     } 

     private void DebugEndpoint_LostFocus(object sender, RoutedEventArgs e) 
     { 
      DebugEndpoint.Tag = false; 
     } 

     private void SettingsPage_GotFocus(object sender, RoutedEventArgs e) 
     { 
      if (!((bool)EnterUserIdInput.Tag) && !((bool)EnterPwdInput.Tag) && !((bool)ServerUrlInput.Tag) && !((bool)DebugEndpoint.Tag)) 
      { 
       this.Scroller.Height = DefaultScrollerHeight; 
       this.Scroller.UpdateLayout(); 
      } 
     } 
     private void PageTitle_Tap(object sender, System.Windows.Input.GestureEventArgs e) 
     { 
      this.Scroller.Height = DefaultScrollerHeight; 
      this.Scroller.UpdateLayout(); 
     } 
    }