Diving into the RichTextBox (Silverlight TV #31)

Download this episode

Download Video

Description

Mark Rideout, Program Manager on the Silverlight product team, joins John to dive deep into many of the RichTextBox control's features. Mark has worked on the text aspects of Silverlight since the first version. Here are just a few of the areas that Mark covers:

  1. Overview of RichTextBox vs. TextBlock and TextBox for rich content
  2. Wire-up logic for applying formatting
  3. Inline UI elements
  4. Using text position to point for simple and complex operations  
  5. Basic "position to point/point to position"
  6. How to walk content and getting rectangle data
  7. Using rectangle data to generate line metrics/highlight bar
  8. The clipboard XAML format and that the same data is exposed in the XAML property
  9. TextAlignment=Justify on paragraph

Don't miss this great deep dive into the RichTextBox control with Mark and John!

Relevant links:

Follow us on Twitter @SilverlightTV or on the web at http://silverlight.tv/

Embed

Format

Available formats for this video:

Actual format may change based on video formats available and browser capability.

    The Discussion

    • User profile image
      MarcSchluper

      Want Hyperlinks to do customizable actions? Read about "interactive text" on The Code Project!

    • User profile image
      USArcher

      Unrelated and not sure if this is something the Silverlight team would be responsible for, but there really needs to be a common Silverlight/HTML app store.  Windows Phone 7 has its MarketPlace and licensing/update services.  I'd love to see something like this for slates/tablets/pcs.

    • User profile image
      Harlequin

      Why is the Xaml property not bindable? Makes the RichTextBox useless in an MVVM-based application.

       

      Edit:

      Quick example,

      Xaml="{Binding SomeRichText}"

    • User profile image
      figuerres

      Yeah i say that the RTB Xaml property got badly done int the first version.... in SL5 i hope they fix it so it's bindable!

    • User profile image
      rhm

      You know this RichTextBox control is fine if it does exactly what you want out of the box.

       

      I would be happier if the Silverlight team would leave making complete high-level controls to 3rd parties (or at least have them as optional downloadable assemblies) and provide the APIs that people can use to write better text layout code. I'd much rather see FormattedText and TextFormatter make their way in so I can write some serious editor control without ugly workarounds. As far as I can see, the only way to lay text out yourself is create a TextBlock add words to it one at a time while measuring it's size and even then you don't get all the font metrics so you can only implement very amateurish text layout.

       

      When people ask "if Silverlight has all these features now and out of browser, why use WPF", text support is the main thing I always think of.

    • User profile image
      vesuvius

      I am still completely unsatisfied with the quality of Silverlight's text rendering, it is still very very poor, when you compare it with offerings like Adobe Air and Flash.

       

      Text is such an important feature, you really need to get it right, and soon. In WPF 4.0 you did improve the text so it was less poor, and not noticable, but if you do a like with like comparison with Winforms/Win32 a trained eye will choose the older technology because it is better - hands down.

       

       

    • User profile image
      rhm

      Lets not get bogged down in that tedious issue. It doesn't matter how crisp the text is if you can't lay it out how you want.

    • User profile image
      vesuvius

      I'm afraid that post maketh no sense, and it is not a tedious issue, it is a rich text box after all! There are two issues here.

       

      If Silverlight is to proliferate the devices market (even embedded systems) then text must look great. I have just installed the MetroTwit application posted in the cofeehouse, and subsequently gone to the new york times website and installed the adobe air program for their times reader application, and it is clear (no pun intended) why they moved the application from WPF to Adobe, and have not elected Silverlight.

    • User profile image
      rhm

      If my post makes no sense to you then you clearly have very poor reading comprehension skills, regardless of the text rendering technology employed.

    • User profile image
      vesuvius

      OK since puerile reasoning is afoot, maybe you can help me?

       

      Lets not get bogged down in that tedious issue. It doesn't matter how crisp the text is if you can't lay it out how you want.

       

      I interject that the text isn't crisp.

       

      You are appearing to suggest that you would prefer a more fully featured richtextbox, that renders text poorly, wheras I am saying that the richtextbox could be better, but the text is still of a very poor quality. This is exacerbated by the fact that the new metro design in silverlight is text centric.

       

      I think it is you that "should have gone to specsavers", I have 20/20 vision, I can see what is written.

    • User profile image
      rhm

      ....

    • User profile image
      rhm

      See, you've completely understood what I wrote, so saying "that makes no sense" is a puerile response. Tongue Out

       

      The text rendering in Silverlight might not meet your standards, but it is perfectly legible. It would be nice if it was better, but the quality isn't stopping people writing applications for Silverlight - I know you imagine it is, but it really isn't. Whereas if you cannot lay out the text in the way you want, that is a major problem.

       

      I find it hard to believe that nobody on the Silverlight team considered that text isn't always laid out in rectangles.

       

      btw. I describe the text 'crispness' issue as tedious because people like you, well mostly just you, are still moaning about WPF4 not being good enough. As such I think it's fair to say that you will never be happy, therefore bringing your whining over to the Silverlight world is just adding noise.

    • User profile image
      vesuvius

      I earn my daily crust in WPF and Silverlight, moving to .NET 4.0 when that was released. I think the steps taken in WPF are excellent, and we upgraded because of the improved text and things like multi-touch.

       

      Silverlight has to be inscrutable to succeed, especially if you are competing with Adobe and Apple. The "it's OK attitude", will only bite you back in the future when uptake of the product is slow. If you put an iPad next to a Silverlight application that is text heavy, the iPad wins. Most users will choose the iPad, because they will use phrases like "it just looks better, I can't quite put my finger on it"

       

      I really recommend you install the metrotwit application and also the newyork times reader application. Silverlight text is still of a very very poor standard, and if it remains as it is, consumers will vote with their feet. It's fine for LOB applications, lets remember the forcing of users  to use dull grey forms, but if you are anyway substandard in this game, you will lose, it is as simple as that.

    • User profile image
      Mike Greenway

      Great Show. 

      and I don't have anything to complain about.

    • User profile image
      davewill

      Thanks John.  Without these FYI posts I wouldn't be able to keep up with the new stuff.

    Comments closed

    Comments have been closed since this content was published more than 30 days ago, but if you'd like to send us feedback you can Contact Us.