我試圖在3個文本塊中的應用程序頁面中顯示文本。我想滾動這個,因爲文本是動態更改的,這取決於我們在前一頁中選擇的內容。當我這樣做這樣的:StackPanel不會與Windows Phone 8中的文本塊一起增長應用程序
<!--LayoutRoot is the root grid where all page content is placed-->
<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 Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
<TextBlock Text="Asystent Barmana" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock Name="PageName" Text="page name" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
</StackPanel>
<ScrollViewer Name="Scroller" HorizontalAlignment="Center" Height="auto" Margin="12,10,10,-1055" Grid.Row="1" VerticalAlignment="Top" Width="460" ManipulationMode="Control" MaxHeight="2500" >
<StackPanel HorizontalAlignment="Left" Height="auto" VerticalAlignment="Top" Width="460">
<TextBlock Name="MissingSkladnik" TextWrapping="Wrap" Height="auto" FontSize="24"/>
<TextBlock Name="Skladniki" TextWrapping="Wrap" Height="auto" FontSize="24"/>
<TextBlock Name="Przepis" TextWrapping="Wrap" Height="auto" FontSize="24"/>
</StackPanel>
</ScrollViewer>
</Grid>
和文本不長它做工精細。但在幾種情況下,文字更長,一些文字被切斷。當我將StackPanel高度更改爲1950年的時候,它顯示的很好,但是當我使用較短的文本時,頁面底部是一個黑色的不滾動:/ 有什麼想法?
PS。我爲我的英語道歉,它已經有一段時間,因爲我用它;)
編輯:
我讀的意見和我改變的StackPanel電網。我這樣做:
<ScrollViewer Name="Scroller" HorizontalAlignment="Center" Height="auto" Margin="12,10,10,-1055" Grid.Row="1" VerticalAlignment="Top" Width="460" ManipulationMode="Control" MaxHeight="2500" >
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Name="MissingSkladnik" TextWrapping="Wrap" Height="auto" FontSize="24" Grid.Row="0"/>
<TextBlock Name="Skladniki" TextWrapping="Wrap" Height="auto" FontSize="24" Grid.Row="1"/>
<TextBlock Name="Przepis" TextWrapping="Wrap" Height="auto" FontSize="24" Grid.Row="2"/>
</Grid>
</ScrollViewer>
它也行不通。如果我設置了堆疊面板的高度,但是當存在少量文本時,它看起來不太好。用戶可以srcoll黑色空白屏幕:/
你可以嘗試一個網格而不是一個堆疊面板嗎? –
設置一些高度到你的stackpanel ..然後嘗試 – loop
我會首先嚐試使用像@KooKiz所說的網格。 – Kajzer