Autosize for cover long multiple textbox WP8

2019-08-11 09:04发布

问题:

I just created textbox in xaml. It is probably filled by very long text.

<TextBox x:Name="txtStory" Grid.Row="1" Grid.Column="1" MinWidth="456" MinHeight="200" TextWrapping="Wrap" Foreground="Black" AcceptsReturn="True" VerticalScrollBarVisibility="Visible"/>

My problem is when i type in multiple line, it will cropped like this

What should i do to make textbox with scrolling or another method that i can use? Thank you

回答1:

You have to set the maximum height of the ScrollViewer and could set the Visibility for the Scrollbars to Auto.

Follow this link for more info

 <ScrollViewer Height="200" VerticalScrollBarVisibility="Auto">
        <TextBox x:Name="txtStory" VerticalAlignment="Top" TextWrapping="Wrap" Height="Auto" HorizontalAlignment="Left" Text="TextBox" Width="460">

        </TextBox>
    </ScrollViewer>

in above example you could set ScrollViewer height according to your need