| Comments

Frankly I’m going to be honest and say I’m not sure why it took us so long to add this capability to TextBlock, especially given that the support in Callisto provided via DynamicTextBlock was originally done in Silverlight 2. O_O. Well, Robby can rest well now knowing that we no longer have to depend on his contributions to Callisto.

DynamicTextBlock sample image

Example of use DynamicTextBlock on bottom

Here’s the quick migration tip.

Change back to TextBlock

The DynamicTextBlock served one purpose, to provide trimming at the character level rather than the word level. The implementation of DynamicTextBlock was done using a ContentControl which, frankly, was probably too heavy handed for the usage here. However since TextBlock is sealed this was necessary. The usage for having this was simple:

<callisto:DynamicTextBlock Text="Some long text here" TextWrapping="NoWrap" />

And changing this to provide platform-supported trimming is simple as well:

<TextBlock Text="Some long text here" TextTrimming="CharacterEllipsis" />

Yep, that’s it.


This migration should be quick and painless. Using the platform’s TextBlock will allow you to benefit from the new typography settings provided in Windows 8.1 (like TextTrimming=”Clip” as well) in conjunction with this as well as better global text support. I’m thankful we were able to add this into the platform finally.

Hope this helps!

| Comments

One of the things that I’ve wanted to do since Silverlight released was two things with text, enable a Stroke and layout text on a Path.  Both of which in Silverlight 2 aren’t readily available.  Luckily we have a great ecosystem of developers and MVPs who love to extend our frameworks and create new capabilities for developers.

Bill Reiss has done just that.  You may recognize Bill from some XNA and Silverlight gaming fame.  His game of Dr. Popper still remains my daughter’s favorite computer game!  Bill has created a new Silverlight user control he calls PathTextBlock control.  Bill describes the new control:

“The PathTextBlock control converts text to a Path which allows you to do a couple of things you can't normally do with text in Silverlight. First of all, instead of a Foreground brush, you have a Stroke and a Fill, which allows you to draw text with an outline. Secondly, the PathTextBlock supports Transform objects which can allow you to distort the text, draw it along a curve, or other transforms. You can easily create your own transforms as well.”

This basically allows you to have a normal TextBlock, but distort and outline it…here’s an example output:

Bill has also included a few transforms to play around with as well.  All of this is included in an Ms-Pl licensed component that is available on Codeplex.  Go check out Bill’s blog post for a link and description.

| Comments

For Silverlight 2, we finally have some native controls to leverage.  Most of them are to aid in input scenarios.  The text input, however, is currently scoped to be plain text input.  Some have desired a richer input control.  You knew it wouldn’t be long before someone in the community stepped up to the challenge.  Christopher Husse has done just that.

Enter: Silverlight rich text editor.

He posts a detailed description of all the capabilities on Michael Syncs blog.  The effort is also posted on Codeplex for you to peruse.

Here is what he calls the ‘incomplete feature list’:

    • Copy/Paste formatted text between RichTextBoxes and copy/paste from/to clipboard of unformatted but macro-enabled text. This means in windows clipboard even things like emoticons will be kept.
    • You may insert line breaks, unordered lists and blockquotes.
    • You may use various keyboard selection features like End/ Home/ PageUp/ PageDown/ Left/ Up/ Right/ Down, Ctrl+A/ End/ Home, Ctrl+Shift+End/ Home/ Left/ Right, Shift+End/ Home/ PageUp/ PageDown/ Left/ Up/ Right/ Down and so forth…
    • Supports direct Unicode character input using “Ctrl”+[NumPad].
    • All silverlight font formatting is supported and even some more like SUP/SUB formatting.
    • You may define macros and a proper object class that should replace matching text, like emoticons…
    • In contrast to many other rich text editors, this one is fully real-time. That means no preview is required because the editor allows editing all things directly.
    • If you only use macros and IRichTextObject to extend the control, you will automatically get support for secure content serialization of all control elements. Content serialization also supports to reload content and edit it again.
    • Secure content serialization gets rid of any potential security leak when storing user typed formatted text on a server and presenting it to visitors, because it is fully verifiable.
    • You may restrict font formatting to a well defined custom subset. This allows you to ensure that all user typed input matches your needs or website design. (this feature is currently not implemented, but only prototyped)
    • Snapshots allow convenient access to formatted content and also Find&Replace with regular expressions for example…

Way to go Christopher!