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

The Actipro Blog

Tag Cloud

  • blog
  • docking
  • editors
  • intelliprompt
  • micro charts
  • navigation
  • propertygrid
  • ribbon
  • shared library
  • silverlight
  • syntaxeditor
  • themes
  • views
  • web site
  • winforms
  • winrt
  • wpf

Latest Twitter News

May 14, 2012 at 2:50 PM
IntelliPrompt code snippet features have been added to our VS-like code editor control for #WPF and #Silverlight. http://t.co/1IchOJrr

May 10, 2012 at 9:40 PM
Our new Micro Charts control products for #WPF and #Silverlight are out now. Come build some dashboards with them! http://t.co/EEERvff0

May 7, 2012 at 6:47 AM
Today we look at bar charts, for our upcoming #WPF, #Silverlight, and #WinRT Micro Charts product. http://t.co/gxHuPS6B

May 4, 2012 at 6:25 AM
See a gallery of micro area charts in our upcoming release for #WPF, #Silverlight, and #WinRT. http://t.co/qDXGwW8B

May 3, 2012 at 6:32 AM
See a variety of line charts that are easy to make with our upcoming #WPF, #Silverlight, #WinRT Micro Charts product. http://t.co/mbkX6tJd

Twitter Follow us on Twitter

Month List

  • 2012
    • May (9)
    • April (6)
    • March (11)
    • February (11)
    • 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 (321)
  • RSS feed for Blog SummaryBlog Summary (15)
  • RSS feed for GeneralGeneral (43)
  • RSS feed for In developmentIn development (164)
  • RSS feed for New featuresNew features (155)
  • RSS feed for New productNew product (38)
  • RSS feed for PromotionPromotion (2)
  • RSS feed for SilverlightSilverlight (90)
  • RSS feed for Tips and tricksTips and tricks (4)
  • RSS feed for Visual Studio 2008Visual Studio 2008 (2)
  • RSS feed for Windows FormsWindows Forms (22)
  • RSS feed for Windows VistaWindows Vista (10)
  • RSS feed for WinRTWinRT (9)
  • RSS feed for WPFWPF (257)
  • 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.

New SyntaxEditor Color Preview Adornment QuickStart

April 12, 2011 at 9:16 AM
by Bill Henning (Actipro)

PostBannerSyntaxEditorDevNotes

One feature we’ve seen in some Visual Studio productivity add-ons is an adornment that shows the actual color specified by a color value in code.  This is very useful for languages like CSS where color values are used throughout the code.

We wanted to show how easy it is to implement the same thing in SyntaxEditor for WPF and Silverlight, so we built a new Color Preview QuickStart for the next maintenance release.  The sample just took a few minutes to create and is a great example of combining SyntaxEditor’s tagging and adornments features.  Here’s the result:

ColorPreview

  The color adornments update live as you type colors in.

How Does It Work?

It’s really rather easy.  First, we create a new tag class called ColorPreviewTag that inherits ITag and has a Color value associated with it.

Next we create a tagger called ColorPreviewTagger that scans text using a Regex to look for hex color values like #ff0000.  When it finds one, it yields back a ColorPreviewTag for that region with the Color value.  Our example can spot both the short (three hex character) and long (six hex character) versions.

Then we create an adornment manager named ColorPreviewAdornmentManager that inherits our DecorationAdornmentManagerBase base class.  This base class does most of the work for you of watching for new tagged ranges and it notifies you when one is found.  All you have to do in ColorPreviewAdornmentManager is create an appropriate adornment element to show.  In this case, we make a rectangle whose fill brush is the tagged color.

Finally, we register tagger provider and adornment manager provider services on our CSS syntax language that point to our new classes and we’re done.

Next Steps

The full source of this sample will be included in the next maintenance releases of WPF Studio and Silverlight Studio.

To further improve on the sample code, you could also scan for known color names (Blue, Red, etc.) and could even make an IntelliPrompt quick info provider that would look for ColorPreviewTag’s under the mouse and show a popup tip with hex and decimal values of the color.

Tags: wpf, silverlight, syntaxeditor
Filed under: Actipro, In development, WPF, Silverlight
Submit to DotNetKicks...
Permalink | Comments (4)

Related posts

Call for early SyntaxEditor for WPF 2009.2 testersThe next release of SyntaxEditor for WPF, part of WPF Studio 2009.2, has a lot of major new function...SyntaxEditor for WPF - Testing adornments with text smoke effectsLately we’ve been working on starting to add adornment layer capabilities to SyntaxEditor for WPF.&#...Code reviewing in SyntaxEditor for WPF, demoing upcoming intra-text adornments featuresAs mentioned in our previous blog post, we’ve been hard at work on some very major new features for ...

Comments

April 13, 2011 at 02:33  

Mike Strobel

Very cool!  I just noticed this functionality in the ReSharper 6 EAP the other day, and this is a great QuickStart idea.

Mike Strobel United Kingdom

April 20, 2011 at 20:59  

Carlos Quintanilla


That is a very nice feature indeed.

Concerning Web Languages AddOn.

Are you planning to include JSON as part of the WPF Web Languages addon for WPF Syntax Editor?

For instance in the new NetBeans 7 it says the following:
Web Languages:
> HTML5 editing support
> JSON formatter

So, I would think that JSON is a Web Language too. Is there any plan to add support for it in an upcoming version?

Thanks!

Carlos Quintanilla Belgium

April 21, 2011 at 01:31  

Bill Henning (Actipro)

Hi Carlos,

Right now we're still focused on getting automated IntelliPrompt for C# and VB in our .NET Languages Add-on.  After that, top requests for enhancing the add-ons are probably XAML and Javascript.

We can add your request for JSON to the SyntaxEditor TODO list.

Bill Henning (Actipro) United States

July 1, 2011 at 00:22  

trackback

Actipro Blog 2011 Q2 Posting Summary

Actipro Blog 2011 Q2 Posting Summary

The Actipro Blog - WPF, Silverlight, and WinForms Development

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