0

我想创建一个弯曲的文本块。它有点类似于这个: 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>
4

1 回答 1

0

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>
于 2013-10-01T20:48:28.390 回答