我想创建一个弯曲的文本块。它有点类似于: 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>
答案 0 :(得分: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>