June, 2010

  • Kirill Osenkov

    Copy Code in HTML format with Visual Studio 2010


    Today Jason has announced the Visual Studio 2010 Productivity Power Tools – a set of VS 2010 extensions that we released to complement and enhance the built-in 2010 features. You can either install the Pro Power Tools from here or just go to the Tools –> Extension Manager and type "Pro Power Tools" in the search box:


    For the Pro Power Tools, I wrote a feature to copy formatted source code to clipboard in HTML format. The traditional VS editor only copies the plain text and RTF formats to clipboard, and there are numerous tools available to convert RTF to HTML. With the Pro Power Tools installed, pressing Ctrl+C or otherwise copying the code editor selection to clipboard, it will place the formatted and colorized HTML fragment on clipboard, alongsize the plain text and RTF format.

    Then you can paste the code anywhere HTML is supported, such as Windows Live Writer:


    Ctrl+Shift+V (Paste Special), Alt+K (Keep Formatting) and Enter to insert the colorized code to Live Writer.

    In a future version of the power tools I will introduce customization – you will be able to fully control what HTML gets generated:

    1. Prepend any HTML to the code fragment
    2. Append any HTML to the code fragment
    3. Prepend any HTML before every line of code
    4. Append any HTML after every line of code
    5. Include line numbers and the format string for them
    6. Replace the space with  
    7. Replace the carriage return line feed with <br />
    8. Emit <span style="color: blue">void</span> vs. <span class="keyword">void</span>

    Also, the current version has a bug: Cut (Ctrl+X) doesn't place formatted HTML to clipboard, only Copy does. I forgot to hook up the Edit.Cut command and never got around to fixing it. I'll fix it for the next release though.

    Hope you like it, and as always, your feedback is appreciated!

    P.S. Here's the sample code formatted using the extension:

            private static string IntersperseLineBreaks(string text)
                text = text.Replace("\n\r", "\n \r");
                return text;
    You can View Source on this page, look for IntersperseLineBreaks and view the HTML that I generate. In a future release you will be able to customize the output of the tool, but for now this is what it defaults to.
  • Kirill Osenkov

    A prototype WPF/Silverlight layout designer


    I’ve been thinking recently about how would I write a WPF UI designer that would specifically highlight the new WPF layout paradigm, and not try to mimic the old WinForms paradigm. The old VB6/WinForms designer was built around absolute positioning. It allowed for rapid WYSIWYG prototyping of interfaces, and the Dock/Anchor functionality provided a relatively cheap and easy support for scalable UI. The new WPF designer in Visual Studio is although very powerful, but some people find it difficult to quickly draft a scalable UI that produces clean XAML.

    So I wrote a concept prototype of how I would like to design WPF UI:


    It runs right in the browser and requires Silverlight 4 (because it needs to copy the output XAML to clipboard). It only focuses on the basics and doesn’t have a lot of features (it’s just a prototype), but I think it can nicely convey my ideas. Nothing of it is new, and both Blend and VS designers support complex layouts with panels and such, but I still decided to write a simple designer without a lot of complex details.

    Let me know what you think!


  • Kirill Osenkov

    Jon Skeet’s C# In Depth, 2nd Edition


    Jon has done it again :) Now with great new chapters on Dynamic, Code Contracts and more: http://manning.com/skeet2/

    C# In Depth was a great book to gain deep understanding of the C# language (up to version 3.0) and how to effectively use its features. The second edition is more complete with full coverage of C# 4.0 and new additions to the .NET Framework (Code Contracts). Code Contracts isn’t strictly a language feature but it’s definitely a great tool in any C# programmer’s toolset and as always, Jon covers it exceptionally well.

    The Second Edition is now available for pre-order. If you’re in the .NET online community, chances are that you’ll hear about the book when it gets released. I really recommend it.

  • Kirill Osenkov

    EasyPainter and other WPF/Silverlight goodies from http://nokola.com


    My fellow tester from the Visual Studio XAML Designer team has a very rich and interesting website: http://www.nokola.com

    One of his hobby projects is EasyPainter – an effect-oriented paint application in Silverlight: http://www.nokola.com/easypainter

    Also definitely check out his blog, he has a lot of interesting things: http://nokola.com/blog


  • Kirill Osenkov

    Notes from the Orlando User Group meeting


    Last night we met with the Orlando .NET User Group. I had a blast! Esteban Garcia, Will Strohl and others did a great job organizing everything (thanks guys!). Very nice folks, great audience, and of course, we just loved Florida!

    Slides from my talk can be downloaded here.

    UPDATE: fixed the link, sorry about that.

    UPDATE 2: it seems that I can't get the MIME types right on my hosting provider. No time to figure it out now, have to put out a .zip file, sorry. Please unzip it to get to the PowerPoint.

    Florida first impressions:

    1. OMG I love it here! Palm trees, great weather, great architecture, great people.
    2. People live in paradise, vacation every day.
    3. (Especially if you like sauna)
    4. It rains every day, and this is a good thing (water evaporates because of the heat).
    5. I wish we had more time here.
  • Kirill Osenkov

    Quick update on the layout designer


    Thanks everyone who commented on my previous post about the layout designer prototype. Hopefully I'll be able to put out the source code in the upcoming weeks. Watch this blog for announcements.

    I've been showing http://layout.osenkov.com to people and the feedback is generally positive. Although it's just a concept prototype and is nowhere near close a working XAML designer, it shows off a couple of ideas that I wanted to illustrate.

    Nikhil Kothari pointed me to his Silverlight Layout Panels project, which explores similar ideas. He has also found that the standard layout panels are missing certain details such as Spacing between children. Very nice ideas!

    Also I was blown away when Dustin Campbell has shown me the DevExpress demos:


Page 1 of 1 (6 items)