我在Windows Phone中設置文本塊的背景時遇到問題。我們如何在Windows Phone中設置TextBlock的背景圖片?
<TextBlock Text="Forget Password" Height="19" Width="156">
我在Windows Phone中設置文本塊的背景時遇到問題。我們如何在Windows Phone中設置TextBlock的背景圖片?
<TextBlock Text="Forget Password" Height="19" Width="156">
你可以試試這個:
<Grid>
<Grid.Background>
<ImageBrush ImageSource="MyImage.jpg" />
</Grid.Background>
<TextBlock Text="Forget Password" />
</Grid>
TextBlock元素無法顯示背景圖像。您可以按如下您的TextBlock後面顯示的圖像:
<Grid>
<Image Source="..."/>
<TextBlock Text="Forget Password" Height="19" Width="156">
</Grid>
您可能需要適當的保證金或填充應用到你的圖像這個工作。
如果要將圖像添加到多個TextBlocks,您可能需要考慮通過樣式重新爲模板TextBlock創建模板。
您可以使用一個邊境管制以包含TextBlock
: -
<Border Background="{StaticResource KeyToDesiredBackgroundBrush}">
<TextBlock Text="Forget Password" Height="19" Width="156" />
</Border>
@ColinE它正在工作,但TextBlock上的文本正在消失。 – Altaf 2011-01-25 10:54:08
爲彩色或圖像? – 2011-01-24 08:06:18