【问题标题】:Scrolling Text Block/Area/Div in Loose XAML在松散 XAML 中滚动文本块/区域/Div
【发布时间】:2008-10-22 12:15:44
【问题描述】:

有没有办法在松散的 xaml 中显示可滚动文本? HTML 中的等价物是

<div style="overflow:scroll">some long bit of text here</div>

您可以在松散的 xaml 中执行此操作吗?

到目前为止,从我的实验看来,在松散的 xaml 中:

  1. 您不能使用 TextBox - 它必须是 TextBlock。
  2. TextBlock 似乎没有任何使其可滚动的样式设置。
  3. 在松散的 xaml 中似乎不允许使用 ScrollViewer。

感谢任何帮助。

【问题讨论】:

    标签: xaml scroll


    【解决方案1】:

    您可以使用文本框来滚动文本,例如:

    <TextBox Text="{Binding YourText}" VerticalContentAlignment="Top"
     TextWrapping="Wrap" AcceptsReturn="True" VerticalScrollBarVisibility="Auto"
    MaxHeight="200" MaxWidth="300"/>
    

    如果您的文本不适合显示区域,这将显示滚动条。

    【讨论】:

      【解决方案2】:
      <ScrollViewer Height="239" VerticalScrollBarVisibility="Auto">
      <toolkit:PhoneTextBox x:Name="newcTextBox" AcceptsReturn="True"  TextWrapping="Wrap"/>
      </ScrollViewer>
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2010-10-13
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-08-25
        相关资源
        最近更新 更多