我把RichTextBox放在我的Silverlight應用程序中。我是否必須創建自己的一組按鈕才能使用它?我想爲文本框設置一組標準的編輯按鈕。如何獲取Silverlight 4 RichTextBox的工具欄?
2
A
回答
4
不幸的是,它只是文本框而不是整套控件,就像工具欄一樣,這是您使用商業WPF/Silverlight富文本框獲得的東西。
你配合你的按鈕高達格式代碼as shown here:
//Set Bold formatting to selected content
private void BtnBold_Click(object sender, RoutedEventArgs e)
{
object o = MyRTB.Selection.GetPropertyValue(TextElement.FontWeightProperty);
if (o.ToString() != "Bold")
MyRTB.Selection.ApplyPropertyValue(TextElement.FontWeightProperty, FontWeights.Bold);
}
//<SnippetItalic>
//Set Italic formatting to selected content
private void BtnItalic_Click(object sender, RoutedEventArgs e)
{
object o = MyRTB.Selection.GetPropertyValue(TextElement.FontWeightProperty);
if (o.ToString() != "Italic")
MyRTB.Selection.ApplyPropertyValue(TextElement.FontStyleProperty, FontStyles.Italic);
}
//Set Underline formatting to selected content
private void BtnUnderline_Click(object sender, RoutedEventArgs e)
{
object o = MyRTB.Selection.GetPropertyValue(TextElement.FontWeightProperty);
if (o.ToString() != "Underline")
MyRTB.Selection.ApplyPropertyValue(TextElement.TextDecorationsProperty, TextDecorations.Underline);
}
1
爲了讓你的Silverlight應用程序使用的Mircosoft Office風格的觸感的格式工具欄,檢查出MSDN Silverlight Text Editor example.
相關問題
- 1. 如何獲取ContextMenu的所有者(來自Silverlight 4工具包)?
- 2. 如何獲取當前行文本從Silverlight 4中RichTextBox控件
- 3. 從Silverlight RichTextBox獲取行數?
- 4. 設置Silverlight 4的xaml RichTextBox
- 5. 獲取Intellij的工具欄
- 6. Eclipse + Git - 如何獲取工具欄?
- 7. Silverlight 4 RichTextBox - InlineUiContainers已禁用
- 8. 打印Silverlight 4 RichTextBox內容
- 9. 如何獲取Silverlight 4工具以在Web Developer 2010 Express中工作?
- 10. 從工具欄獲取ImageView
- 11. Silverlight 2邊欄小工具
- 12. RCP 4切換工具欄
- 13. CKEditor 4工具欄定義
- 14. 從Silverlight獲取文本顏色RichTextBox
- 15. Firefox 4工具欄覆蓋
- 16. 工具欄在Ext Js 4
- 17. Silverlight 4工具包中的WrapPanel
- 18. 的Silverlight 4工具包圖表問題
- 19. 如何從RichTextBox獲取RTF
- 20. 如何獲取richtextbox行?
- 21. 如何訪問Silverlight 4中RichTextBox的內部網格?
- 22. 如何加載和保存Silverlight 4 RichTextBox控件的內容?
- 23. RichTextBox與拼寫檢查器silverlight 4
- 24. Silverlight 4 RichTextBox滾動到底部
- 25. Silverlight 4 RichTextBox使用DataContext綁定數據
- 26. 處理Silverlight 4 RichTextBox粘貼事件
- 27. 獲取RichTextBox的
- 28. cocoa:如何獲取工具欄的標籤
- 29. 如何獲取Mail.app和Xcode中的兩行工具欄?
- 30. 如何獲取對工具欄中複選框的引用?
這是很好的解決方案,可以完成這個控制http://wintoolbar.codeplex.com/ – ahmedsafan86 2012-11-03 17:27:59