• Products
  • Download
  • Purchase
  • Support
  • Company
Actipro Software company logo
Twitter Follow Actipro RSS Subscribe (RSS Feed)

The Actipro Blog

Tag Cloud

  • aero
  • blog
  • docking
  • editors
  • gauge
  • intelliprompt
  • navigation
  • propertygrid
  • ribbon
  • shared library
  • silverlight
  • syntaxeditor
  • themes
  • views
  • winforms
  • wpf

Latest Twitter News

November 21, 2011 at 11:14 AM
#WPF Studio 2011.2 is out now! Includes enhanced themes for native WPF conrtols and new SyntaxEditor features. http://t.co/uEMCaGPG

September 26, 2011 at 1:25 PM
If you'd like to see our #WPF / #Silverlight SyntaxEditor code editor control ported to Metro, provide feedback here: http://t.co/xXBNIDTi

September 15, 2011 at 8:31 PM
If you want to see SyntaxEditor eventually show up in Win8's #xaml UI, be sure to add your support to this MS thread: http://t.co/FBjz6TuC

August 15, 2011 at 1:47 PM
New SyntaxEditor IntelliPrompt parameter info feature docs/samples ready for the 2011.2 #WPF and #Silverlight releases. http://t.co/ezoYIjv

August 2, 2011 at 2:40 PM
First look at new automated IntelliPrompt parameter info coming to our C#/VB editor control in #WPF / #Silverlight http://t.co/CUz6O1T

Twitter Follow us on Twitter

Month List

  • 2012
    • February (3)
    • January (2)
  • 2011
    • December (2)
    • November (7)
    • October (2)
    • September (1)
    • August (5)
    • July (3)
    • June (6)
    • May (5)
    • April (8)
    • March (4)
    • February (5)
    • January (9)
  • 2010
    • December (9)
    • November (10)
    • October (4)
    • September (8)
    • August (12)
    • July (9)
    • June (7)
    • May (6)
    • April (7)
    • March (6)
    • February (6)
    • January (4)
  • 2009
    • December (2)
    • November (2)
    • October (12)
    • September (3)
    • August (11)
    • July (10)
    • June (6)
    • May (3)
    • April (7)
    • March (6)
    • February (8)
    • January (10)
  • 2008
    • December (10)
    • November (2)
    • October (3)
    • September (5)
    • August (5)
    • July (8)
    • June (4)
    • May (4)
    • April (10)
    • March (8)
    • February (1)
    • January (2)

Category List

  • RSS feed for ActiproActipro (289)
  • RSS feed for Blog SummaryBlog Summary (13)
  • RSS feed for GeneralGeneral (34)
  • RSS feed for In developmentIn development (150)
  • RSS feed for New featuresNew features (140)
  • RSS feed for New productNew product (30)
  • RSS feed for PromotionPromotion (2)
  • RSS feed for SilverlightSilverlight (71)
  • RSS feed for Tips and tricksTips and tricks (4)
  • RSS feed for Visual Studio 2008Visual Studio 2008 (2)
  • RSS feed for Windows FormsWindows Forms (20)
  • RSS feed for Windows VistaWindows Vista (10)
  • RSS feed for WPFWPF (235)
  • RSS feed for XAMLXAML (23)

About Us

Actipro Software is a leading provider of .NET user interface controls for the WPF, Silverlight, and WinForms frameworks, and is most well-known for their SyntaxEditor syntax-highlighting code editor control.

Please take some time to learn more about us and our product offerings.

SyntaxEditor for WPF – Hide text regions without using outlining (part 2)

February 12, 2010 at 8:37 AM
by Bill Henning (Actipro)

In the last blog post we discussed how to hide text regions without using the code outlining feature in SyntaxEditor for WPF.  Today I’d like to show how you can replace the collapsed text regions with an intra-text adornment.

CollapsedRegion1 

Here is a another open source QuickStart that ships with SyntaxEditor.  In the editor, I will select some text and then press the Collapse Selected Text button at the top.

CollapsedRegion2

Similar to our last QuickStart, the text that was selected was hidden.  The difference is that here, we have reserved some space in-line with the text and rendered a custom adornment in that space.  The custom adornment could be anything, even a control.  For this QuickStart, we made it look like a standard collapsed text adornment. 

How does it work?

As in the previous post, we are using an ICollapsedRegionTag object to “tag” the region that should be hidden.  In this sample we also will tag the same text range with IIntraTextSpacerTag. The SyntaxEditor text formatting engine knows that when a collapsed region is found, it should look for an intra-text spacer with the same range.  If one is found, it will use that in place of where the collapsed text would have been.

Then the final step is to make an adornment manager that inherits our IntraTextAdornmentManagerBase class.  With that, it automatically finds intra-text spacer tags of the type you specify and asks you for an adornment element anytime one is found.  In the case of this sample, our adornment is the gray border with the ellipses inside.

The whole model is completely extensible in many ways, and allows you to achieve some really neat effects.

Summary

In SyntaxEditor for WPF, you now have three ways you can hide text:

  • Hide a text region and render nothing in its place, similar to the last post.
  • Hide a text region and render an adornment in its place, like above.
  • Use the code outlining feature to manage collapsible regions of text.

Some other uses for the feature demoed in this post… maybe you want to change any instance of a [ or ] character into some image that represents an open and close brace, thus providing more of a visual impact.  You would simple collapse the text ranges of either of those characters and render adornments (that are the images) in their place.  That sounds like another great idea for a QuickStart.  Maybe we’ll add a sample like that in the future! :)

Tags: wpf, syntaxeditor
Filed under: Actipro, New features, WPF
Submit to DotNetKicks...
Permalink | Comments (5)

Related posts

SyntaxEditor for WPF – Hide text regions without using outlining (part 1)One of the recently added features of SyntaxEditor for WPF is the ability to hide a region of text i...Complete code outlining support added to SyntaxEditor for WPFWe just published WPF Studio 2009.2 build 514 and some of its new features are the culmination of ov...Actipro SyntaxEditor for WPF and Editors for WPF are released SyntaxEditor for WPF with a custom theme loaded Yesterday evening we published WP...

Comments

February 11, 2010 at 15:06  

Jesper

If you hide text regions like this, do you get to control what happens when a selection surrounding this region is deleted, or what it puts on the clipboard when copied?

Jesper Sweden

February 11, 2010 at 15:12  

Bill Henning (Actipro)

With collapsed text, the text is still in the document.  So from the document's perspective, nothing is hidden.  You can always handle events like the document's TextChanging/ed events on any text change.

Also the SyntaxEditor.CutCopyDrag event fires before any text is placed on the clipboard.  So you can customize it there as needed.

Bill Henning (Actipro) United States

February 11, 2010 at 15:51  

Jesper

That makes sense. I was just thinking that since you may use this as VS2010's inline adornments to replace a placeholder with something else like some sort of visualization, you could want to customize how that copies as well.

If you programmatically select halfway through stock outlining collapsed text (or a subrange of it), where does the editor draw the insertion point/caret? What does shift+left/right do?

Jesper Sweden

February 11, 2010 at 16:02  

Bill Henning (Actipro)

I believe in that case the caret will render to the closest side of the adornment, and the caret should pop out of the collapsed region with a shift+left/right.

Bill Henning (Actipro) United States

March 31, 2010 at 03:39  

trackback

Actipro Blog 2010 Q1 posting summary

Actipro Blog 2010 Q1 posting summary

The Actipro Blog - WPF and WinForms Development

Comments are closed
Copyright © 1999-2012 Actipro Software LLC. All rights reserved.
Home Actipro Software | Products | Download | Contact Us