0

我发现 ScrollViewer 的奇怪行为包含 TextBlock。只要我输入超过 48 个字符串,文本就会在滑动时被截断。

这是我的例子:

<controls:PivotItem x:Name="PivotItem2" Header="2">
                       <Grid>
                        <ScrollViewer Margin="0,0,0,0"  Width="427">
                        <StackPanel  Margin="0,0,0,6">
                          <StackPanel.Background>
                             <ImageBrush Stretch="Fill"/>
                           </StackPanel.Background>
                            <TextBlock x:Name="DATE" HorizontalAlignment="Left" TextWrapping="Wrap" Text="PublicDate" Foreground="White"/>
                            <TextBlock x:Name="CONTENT" TextWrapping="Wrap" Foreground="White"  FontSize="32">
                             <Run Text="1"/><LineBreak/><Run Text="2"/><LineBreak/><Run Text="3"/><LineBreak/><Run Text="4"/><LineBreak/><Run Text="5"/><LineBreak/><Run Text="6"/><LineBreak/><Run Text="7"/><LineBreak/><Run Text="8"/><LineBreak/><Run Text="9"/><LineBreak/><Run Text="0"/><LineBreak/><Run Text="11"/><LineBreak/><Run Text="12"/><LineBreak/><Run Text="13"/><LineBreak/><Run Text="14"/><LineBreak/><Run Text="15"/><LineBreak/><Run Text="16"/><LineBreak/><Run Text="17"/><LineBreak/><Run Text="18"/><LineBreak/><Run Text="19"/><LineBreak/><Run Text="20"/><LineBreak/><Run Text="21"/><LineBreak/><Run Text="22"/><LineBreak/><Run Text="23"/><LineBreak/><Run Text="24"/><LineBreak/><Run Text="25"/><LineBreak/><Run Text="26"/><LineBreak/><Run Text="27"/><LineBreak/><Run Text="28"/><LineBreak/><Run Text="29"/><LineBreak/><Run Text="30"/><LineBreak/><Run Text="31"/><LineBreak/><Run Text="32"/><LineBreak/><Run Text="33"/><LineBreak/><Run Text="34"/><LineBreak/><Run Text="35"/><LineBreak/><Run Text="36"/><LineBreak/><Run Text="37"/><LineBreak/><Run Text="38"/><LineBreak/><Run Text="39"/><LineBreak/><Run Text="40"/><LineBreak/><Run Text="41"/><LineBreak/><Run Text="42"/><LineBreak/><Run Text="43"/><LineBreak/><Run Text="44"/><LineBreak/><Run Text="45"/><LineBreak/><Run Text="46"/><LineBreak/><Run Text="47"/><LineBreak/><Run Text="48"/><LineBreak/><Run Text="49"/><LineBreak/><Run Text="50"/><LineBreak/><Run Text="51"/><LineBreak/><Run Text="52"/><LineBreak/><Run Text="53"/><LineBreak/><Run Text="54"/><LineBreak/><Run Text="55"/><LineBreak/><Run Text="56"/><LineBreak/><Run Text="57"/><LineBreak/><Run Text="58"/><LineBreak/><Run Text="59"/><LineBreak/><Run Text="60"/><LineBreak/><Run Text="61"/><LineBreak/><Run Text="62"/><LineBreak/><Run Text="63"/><LineBreak/><Run Text="64"/><LineBreak/><Run Text="65"/><LineBreak/><Run Text="66"/><LineBreak/><Run Text="67"/><LineBreak/><Run Text="68"/><LineBreak/><Run Text="69"/><LineBreak/><Run Text="70"/><LineBreak/><Run Text="71"/><LineBreak/><Run Text="72"/><LineBreak/><Run Text="73"/><LineBreak/><Run Text="74"/><LineBreak/><Run Text="75"/><LineBreak/><Run Text="76"/><LineBreak/><Run Text="77"/><LineBreak/><Run Text="78"/><LineBreak/><Run Text="79"/><LineBreak/><Run Text="80"/><LineBreak/><Run Text="81"/><LineBreak/><Run Text="82"/><LineBreak/><Run Text="83"/><LineBreak/><Run Text="84"/><LineBreak/><Run Text="85"/><LineBreak/><Run Text="86"/><LineBreak/><Run Text="87"/><LineBreak/><Run Text="88"/><LineBreak/><Run Text="!Binding MessageText"/>
             </TextBlock>

                     </StackPanel>
                      </ScrollViewer>
                    </Grid> 
   </controls:PivotItem>

这是我的屏幕截图:

在此处输入图像描述

4

1 回答 1

1

这是标准的滚动查看器行为(即使在 Silverlight 之外)。内容滚动到用户停止的地方。如果您希望在用户停止滚动时始终显示文本项,则需要实现额外的逻辑。

于 2012-04-20T12:53:41.807 回答