【问题标题】:textblock as a curve in windows phone 8文本块作为 Windows Phone 8 中的曲线
【发布时间】:2013-10-01 18:43:32
【问题描述】:

我想创建一个弯曲的文本块。它有点类似于这个: http://i.stack.imgur.com/sCJuQ.gif 我如何在表情混合中做到这一点? 即使我尝试在路径列表框布局上设置文本块,它也会以垂直方式打印,而不是在路径布局上。

<FrameworkElement.Resources>
            <TextBlock x:Key="TextRes" Text="world wide web"/>
</FrameworkElement.Resources>
<mec:PathListBox  ItemsSource="{Binding Text, Source={StaticResource TextRes}}">
            <mec:PathListBox.LayoutPaths>
                <mec:LayoutPath Orientation="OrientToPath">
                    <mec:LayoutPath.SourceElement>
                        <Ellipse Height="436" Width="352" />
                    </mec:LayoutPath.SourceElement>
                </mec:LayoutPath>
            </mec:PathListBox.LayoutPaths>
 </mec:PathListBox>

【问题讨论】:

    标签: c# windows-phone-8 expression-blend


    【解决方案1】:

    PathListBox 进行实验。关键是将ItemsSource设置为字符串并使用OrientToPath。以下 xaml 适用于 WP7。

    <mec:PathListBox xmlns:mec="clr-namespace:Microsoft.Expression.Controls;assembly=Microsoft.Expression.Controls"
      ItemsSource="world wide web">
      <mec:PathListBox.LayoutPaths>
        <mec:LayoutPath Orientation="OrientToPath">
          <mec:LayoutPath.SourceElement>
            <Ellipse Height="91" Width="300"/>
          </mec:LayoutPath.SourceElement>
        </mec:LayoutPath>
      </mec:PathListBox.LayoutPaths>
    </mec:PathListBox>
    

    即使设计器对字符串发出警告,它也会编译并运行。或者你可以这样做:

    <FrameworkElement.Resources>
      <TextBlock x:Key="TextRes" Text="world wide web"/>
    </FrameworkElement.Resources>
    <mec:PathListBox
      ItemsSource="{Binding Text, Source={StaticResource TextRes}}">
      <mec:PathListBox.LayoutPaths>
        <mec:LayoutPath Orientation="OrientToPath">
          <mec:LayoutPath.SourceElement>
            <Ellipse Height="91" Width="300"/>
          </mec:LayoutPath.SourceElement>
        </mec:LayoutPath>
      </mec:PathListBox.LayoutPaths>
    </mec:PathListBox>
    

    【讨论】:

    • 它会抛出一个错误,说 itemssource 不能设置为字符串。
    • 很抱歉发布有问题的代码。但是这个问题被搁置了,我还没有得到答案。以垂直方式显示文本内容。你给我的代码有没有得到预期的结果?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-01-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-02-14
    相关资源
    最近更新 更多