TEXTBOX SCROLLING IN WINDOWS PHONE APP NOT WORKING

Royce Roy

Total Post:149

Points:1043
Posted by  Royce Roy
 908  View(s)
Ratings:
Rate this:
I have a page in a Windows Phone app. This page is rather "tall". For that reason, the entire page is wrapped in a ScrollViewer. Towards the bottom of the page is a TextBox. This TextBox is intended to be a multi-line TextBox with TextWrapping="Wrap". I need for the user to be able to scroll up-and-down within the TextBox to see the content they have typed. However, I am unable to scroll within the TextBox itself. Instead, when I attempt to scroll, the entire page scrolls. How do I remedy this? I tried adding ScrollViewer.VerticalScrollBarVisibility="Auto" however, that does not seem to work either. Here is an exerpt of my XAML
<Grid x:Name="LayoutRoot" Background="{StaticResource PhoneBackgroundBrush}">
  <Grid.RowDefinitions>
    <RowDefinition Height="Auto"/>
    <RowDefinition Height="*"/>
  </Grid.RowDefinitions>
  <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
    <TextBlock x:Name="ApplicationTitle" Text="APPNAME" Style="{StaticResource PhoneTextNormalStyle}" />
    <TextBlock x:Name="PageTitle" Text="{Binding Path=PageTitle}" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
  </StackPanel>
  <ScrollViewer Grid.Row="1">
    <Grid x:Name="ContentPanel" Margin="12,0,12,0">
       ...
      <TextBox x:Name="bodyTextBox" Text="{Binding Path=Body, Mode=TwoWay}" Height="145"  TextWrapping="Wrap" InputScope="Text" Grid.Row="6" MaxLength="1024" Margin="0,-8,0,0" />
    </Grid>
  </ScrollViewer>
</Grid>
  1. Mayank Tripathi

    Post:397

    Points:3117
    Re: TextBox Scrolling in Windows Phone App not working

    In my experience, this is usually caused by incorrectly using an "auto" height tag or a "starSizing" height tag somewhere. I would try setting fixed heights for relevant elements (especially your RowDefinition) and see that helps

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!