using System.Drawing;
using System.Windows.Controls;
using System.Windows.Documents;
public static class ExtensionMethods
{
public static string GetText(this RichTextBox textBox)
{
TextRange textRange = new TextRange(textBox.Document.ContentStart, textBox.Document.ContentEnd);
return textRange.Text;
}
public static Font GetFont(this RichTextBox textBox)
{
FontFamily fontfam = new FontFamily(textBox.FontFamily.Source);
Font font = new Font(fontfam, (float)textBox.FontSize);
return font;
}
}
Tuesday, September 20, 2011
WPF RichTextBox Text and Font Extension Methods
Subscribe to:
Posts (Atom)