WPF Blog Writer by Lester

This past winter, I had coded a custom control which has a RichTextBox with toolbar for various formatting commands. I had hoped to publish it as a a standalone control sample which people could reuse, but it needed some styling to make the control look prettier. Lester has done a great job with that code and…

1

Dave Relyea’s Silverlight Layout Controls

One of the topmost questions about Silverlight has been the lack of layout controls and TextBox. Dave Relyea has put together a great set of sample layout controls for Silvelight in C#. The controls in his project are: Layout framework LayoutControl and LayoutContainerControl base control classes Border StackPanel Grid Label Button (XAML courtesy of Mike Harsh)…

0

Back from the Silverlight cave

It is time to catch up with blogging after a long silence from my end. Earlier this year, I moved to work on WPF/e aka Silverlight team. It has been an exciting time and now that the cat is out of the bag, I am looking forward to blogging some fun Silverlight samples. Stay tuned. For…

0

Printing Contents of WPF RichTextBox

I was recently playing with code to print contents of WPF RichTextBox control. The SDK has a code sample on this at http://msdn2.microsoft.com/en-us/library/aa970917.aspx             // Print RichTextBox content             private void PrintCommand()             {                 PrintDialog pd = new PrintDialog();                 if ((pd.ShowDialog() == true))                 {                     //use either one of the below                          pd.PrintVisual(richTB as…

5

Upcoming WPF Technical Chat

The WPF team will be hosting our first ever live online technical chat on the MSDN site next Thursday, December 21st, at 12:30pm Pacific Time (that’s 3:30pm ET, 8:30pm GMT, 9:30pm CET). We’ll have a collection of the WPF team on hand to answer your technical questions, hear your feedback on what we should be…

0

Auto-detecting Hyperlinks in RichTextBox – Part II

In my previous post, we looked at code that auto-formats hyperlink strings while typing. The remaining part was to scan words when content is pasted in RichTextBox to auto-format any hyperlink strings. The approach to do this is quite straight forward as you can imagine. Listen to DataObject.Pasting event on RichTextBox, set a flag to remember the…

2

Replying to Messages

I received a few questions from my blog readers in email. I will try my best to answer them in this post. Question 1: Hi there! I saw that you were posting about the use of RichTextBox control and I thought you might be able to help me on my problem: how can I get the…

1

Navigate Words in RichTextBox

A commonly asked question on the WPF forum is – how can I navigate RichTextBox‘s content word by word (see http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=778441&SiteID=1). In today’s post, we will see how this can be done using the TextPointer API. What we need is a helper function which takes a TextPointer position and returns us the word start and word…

1

Auto-detecting Hyperlinks in RichTextBox – Part I

In this post, we will see a custom RichTextBox implementation that auto-detects Hyperlinks while typing. In a later post, I will demonstrate how auto-detection can be done on paste command. Both these parts together enable complete auto-detect support for hyperlinks in a RichTextBox. For simplicity, in this demo, my code detects the string www.microsoft.com as a hyperlink….

2

Customize RichTextBox to allow only plain text input (with custom ContextMenu)

In this post, we will look at a custom RichTextBox implementation. In V1, TextBox selection highlight is not extensible and TextBox schema is restricted to plain text only. Often customers want a “rich” TextBox, where they can apply formatting properties (such as bold, underline) to Runs of text. I coded a sample that demonstrates how one…

3