Scrollview in xaml , to create the interfaces of the universal applications of windows 10 UWP, I find a problem with the scrollviewer
, it cuts the text of a textblock
and the entire scroll of the page does not work, but if I define a value to height
the textblock
scroll It works perfect.
<Page
x:Class="AboutThisPattern.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:AboutThisPattern"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" RequestedTheme="Light">
<ScrollViewer Background="White">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*" />
<RowDefinition Height="2*" />
</Grid.RowDefinitions>
<RelativePanel Grid.Row="0" Background="#FF003D66" RequestedTheme="Dark">
<Image x:Name="image" HorizontalAlignment="Center" Margin="45,20,219,0" VerticalAlignment="Top" Source="ms-appx:///Assets/Square150x150Logo.png" Stretch="UniformToFill" Width="96" Height="96"/>
<TextBlock x:Name="textBlock" HorizontalAlignment="Left" Margin="146,20,0,0" TextWrapping="Wrap" Text="App name" VerticalAlignment="Top"/>
<TextBlock x:Name="textBlock_Copy" HorizontalAlignment="Left" Margin="146,45,0,0" TextWrapping="Wrap" Text="1.0.0" VerticalAlignment="Top"/>
</RelativePanel>
<RelativePanel Grid.Row="1">
<TextBlock x:Name="textBlock1"
TextWrapping="Wrap"
Height="auto"
Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus viverra orci ut erat viverra, eu tempus lacus dictum. Sed vehicula euismod nulla, nec fermentum eros vulputate at. Morbi nec mauris quis augue pretium pulvinar eget vel ipsum. In suscipit nisl eu magna tempor suscipit. Vivamus eleifend imperdiet faucibus. Mauris imperdiet, nunc a elementum aliquam, mi risus tristique lectus, vitae ultricies tortor ligula vitae purus. Vestibulum laoreet a risus eget condimentum. Quisque faucibus, justo vitae dignissim semper, leo augue varius mi, ac maximus tortor magna in massa. Cras tincidunt elit vitae nibh maximus, a pretium nisl efficitur. Cras eros velit, dictum eu posuere vitae, tincidunt ac ipsum. Morbi maximus ultricies purus, sed maximus risus volutpat sed. Vestibulum euismod ante id diam lobortis egestas. Etiam at rutrum augue. Proin facilisis sagittis enim, a sodales nisi feugiat in. Fin de la nota!"
Margin="10,20,10,-120.667"/>
</RelativePanel>
</Grid>
</ScrollViewer>
If I put that in textBlock1
, it doesn't work, Height="auto"
but if I do Height=700
, you can scroll the entire page, but if I turn it horizontally, too much white space is displayed. How can I automatically adjust to the height it needs textblock
to display its content? Or how would you solve that interface design?
Fixed, the problem was in the margin value, which was negative, and you can remove the height="auto"