我們可以使用編輯模闆來定義RichTextBox的背景圖檔
下面是實作步驟:
1. 建立Silverlight項目,命名為RichTextBoxBackground
<a href="http://blog.51cto.com/attachment/201105/204254194.png" target="_blank"></a>
2. 右擊項目,添加現有項目,選擇要添加的背景圖檔,這裡我們添加一個256*256的圖檔
<a href="http://blog.51cto.com/attachment/201105/204323888.png" target="_blank"></a>
3. 向美化闆中添加RichTextBox
4. 設定其長寬均為256*256
<a href="http://blog.51cto.com/attachment/201105/204448791.png" target="_blank"></a>
5. 右擊RichTextBox,選擇編輯模闆,編輯拷貝
<a href="http://blog.51cto.com/attachment/201105/204510280.png" target="_blank"></a>
6. 選擇Border,将其背景色重置
<a href="http://blog.51cto.com/attachment/201105/204547715.png" target="_blank"></a>
7. 導航到Title Brush,選擇添加的圖檔
8. 運作後效果圖下:
<a href="http://blog.51cto.com/attachment/201105/204703211.png" target="_blank"></a>
本文轉自xshf12345 51CTO部落格,原文連結:http://blog.51cto.com/alexis/574836,如需轉載請自行聯系原作者