簡體   English   中英

在Windows Phone 8中將textblock作為曲線

[英]textblock as a curve in windows phone 8

我想創建一個彎曲的文本塊。 它有點類似於此: 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>

PathListBox 關鍵是將ItemsSource設置為string並使用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>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM