PDC 2008 - Microsoft shows huge commitment to WPF in development tools

Thursday, October 30, 2008 4:08:30 PM (Central Standard Time, UTC-06:00)

Microsoft has used WPF to write tools in the past... Expression Blend and Design being two of those tools among others.  Its extremely exciting to see that they are making even a bigger commitment to WPF as a platform for writing applications.  This week at PDC they announced that the shell of the Visual Studio 2010 IDE will be written in WPF.  Since Visual Studio has a huge legacy code base and many tools already built a top the DTE, not all of it will be converted to WPF and managed code.  However, one of the most noticeable changes will be that the code editor will be written using the rich text capabilities of WPF... which means that we will now have a very powerful presentation model (rich text, animation, etc) in the IDE that we can leverage to build better IDE experiences. This also means that the bar for extending Visual Studio IDE will be greatly reduced.

Customizing the Visual Studio Start Page

One of the extension points for VS 10 will be modifying the start page... which is possible today, but the model for integrating into other aspects of the IDE (like macros or commands) will be far simpler than what we have today.  To customize the home page  will require you to modify the Xaml file that is found in Documents\Visual Studio 10\Start Page\StartPage.xaml.  To integrate with Visual Studio commands will be a matter of passing in a well-known string identifier for the command.

Managed Extension Framework (MEF) enables the Add-In Model

The new text editor will be composed of MEF components which can be swapped out and customized by supplying your own implementation.  The customization capabilities will be limited to the following areas :

Classification: Rich Text Formatting

- Which will allow us to create a richer reading environment for code.

- Ability to leverage WPF's rich text capabilities.

 

Adornments: Power Graphics

Any WPF visual - can render a UI element anywhere.

- Associate adornments with text, render comments in the MSDN document style inline with code.

- Support for animation and behavior of different aspects of the code.

 

Margin and Scrollbar Customization

- Allows for the ability to create visual representations of structure in the margins of the code editor... this looked very similar to the way ReSharper implemented their Marker Bar (shown below).

image

 

 

Intellisense and Smart Tags

- Contribute to completion of Intellisense ... meaning that we can now filter items.  For a long time I have wanted the ability to modify the intellisense so that when I need to I can just view only the properties, methods or events for a type... and it looks like now the bar may be lowered enough to implement something like this relatively easily.

- Override the presentation of the parameter help or quick info

- Add menu items to smart tags

 

If you want more information, you can check out the videos on channel9

PDC 2008 - Day 2 Keynote

Tuesday, October 28, 2008 6:51:04 PM (Central Standard Time, UTC-06:00)

Yesterday's keynote talked heavily about infrastructure... today was focused Windows 7 and the frameworks /services we use to build applications in the cloud.  They did a cursory review of the new features of Windows 7 with a focus on behavior and user experience.  They also drilled down into some of the new features that appeal to more of a power user... the ability to create and attach to VHD's from within Windows and even boot to them if you would like.  It also showed more capability around configuring multi-monitors... ability to remote desktop into another machine which will then use your multi-monitor setup (that's cool).  They also said that they are focused on creating a quality OS and they will not release Windows 7 until it is ready. 

Check out the E7 Blog and give feedback on Windows 7.

 

They also made a number of important announcements around WPF and Silverlight:

  • Releasing the Ribbon control for WPF in CTP form
  • Adding touch events onto WPF elements to support multi-touch
  • Released controls include DataGrid, DatePicker, Calendar and Visual State Manager

Visual Studio 2010 will be built on WPF!!!!!

  • It will support richer code editing support
  • It will utilize the Managed Extensibility Framework to extend Visual Studio... which simplifies the add-in model. 

 

Silverlight

  • Added the following controls to Silverlight 2.0... Chart, Treeview, DockPanel, WrapPanel, Viewbox, Expander, Autocomplete and a couple of others.
  • Enabling the ability to run Silverlight both on the desktop and browser

WPF Office Ribbon and other goodies released at PDC

Tuesday, October 28, 2008 4:55:06 PM (Central Standard Time, UTC-06:00)

You can get the newest WPF Ribbon, DatePicker/Calendar control, preview of VisualStateManager (VSM) for WPF from the WPF Toolkit site... in addition the DataGrid is now out of CTP and was released.

image

PDC 2008 - Blend Tips & Tricks

Monday, October 27, 2008 6:48:07 PM (Central Standard Time, UTC-06:00)

I was a little disappointed in the content of this presentation.  There wasn't as many Tips & Tricks as I would have expected.  One of the tips they attempted to show (which the demo actually failed) involved showing what happens when you try to access an object that isn't available on the Blend design surface... the result on the design surface is an exception that keeps you the user from previewing the UI. If I recall correctly they were were trying to check whether the Page object was available by checking the IsEnabled property, which seems a bit unusual.  I have ran into similar issues with Blend and this is the trick I have used before accessing an object that may not be available when the UI is rendered on the design surface.

/// <summary>
    /// Base class for all Parts in the Shell
    /// </summary>
    public class UIPart : System.Windows.Controls.UserControl, IPart
    {
        
        #region Constructors
 
        /// <summary>
        /// Initializes a new instance of the <see cref="UIPart"/> class.
        /// </summary>
        public UIPart()
        {
            //if we don't check this... the UI will not display correctly in the designer.
            if (InDesignMode)
                return;
 
            partIdField = this.GetType().Name + "_" + Guid.NewGuid();
 
            this.GotFocus += UIPart_GotFocus;
            this.Loaded += UIPart_Loaded;
            this.IsVisibleChanged += UIPart_IsVisibleChanged;
            this.Initialized += UIPart_Initialized;
        }
 
        /// <summary>
        /// Gets a value indicating whether [in design mode].
        /// </summary>
        /// <value><c>true</c> if [in design mode]; otherwise, <c>false</c>.</value>
        public bool InDesignMode
        {
            get { return System.ComponentModel.DesignerProperties.GetIsInDesignMode(this); }
        }

One thing that I did gleam from the talk was that there is a new version of Snoop  available that has the capability to render the composition of an application in a 3D model, the composite model of Blend is shown below:

blendcomposte3d

PDC 2008 Keynote

Monday, October 27, 2008 6:23:16 PM (Central Standard Time, UTC-06:00)

Announced Windows Azure - Web Tier offering that can be thought of as Windows in the cloud. 

  • Scalable Storage
  • Scalable Computing Power
  • Services Lifecycle Management

The systems that are being built today are laying the ground work for the next 50 years. 

Services platform will include the following support:

  • Live Services - Acts as a bridge between devices (phones, laptops and other devices)
  • .NET Services - Workflow, authorization and identity federation.
  • SQL Services - Data Store
  • SharePoint Services - Collaboration
  • Dynamics CRM Services - Business Content

Ray pointed out, that even though they aren't the first to enter the cloud services arena (Amazon just went out of beta this week with their offering EC2), they have some key components that allow them to provider a better platform:

  • Microsoft is consuming their own cloud services to build Microsoft offerings in the cloud. 
  • Microsoft will use the existing tools we have today to build systems that run in the cloud.

 

Demo - Building Cloud Applications... was a basic demo of how you could build a ASP.NET web site and use the Azure console to upload a package (binaries and configuration meta data) to be deployed to the platform for serving up the information.

Demo - Bluehoo.com

Social Networking application that shows you who is around you based on BlueTooth protocol on your cell phone.  Similar to how you detect wireless networks... except you are detecting people that are part of the Bluehoo network.  Bluehoo is utilizing Windows Azure to support their application scalability.

m.bluehoo.com - beta is available later today.

Another WPF Debugging Tool - Cracked.NET

Sunday, October 26, 2008 6:52:27 PM (Central Standard Time, UTC-06:00)

I met with Josh Smith tonight and he had mentioned that he has released a new debugging tool for WPF (I think it will also work on WinForms) called Cracked.NET.  One of the things that is interesting about this is that Josh is using Iron Python to inject scripts into the application at runtime.

Twin City Code Camp slides - Using WPF in Line of Business Applications

Tuesday, October 21, 2008 2:54:35 PM (Central Daylight Time, UTC-05:00)

Back on October 11th I spoke at the Twin City Code Camp.  Here is the slide deck that was used.

Its tough to stay on top of blogs...

Wednesday, October 08, 2008 9:33:01 PM (Central Daylight Time, UTC-05:00)

So today I was discussing this with Scott Colestock and he suggested rssfwd... not that I need more email... but at least I can quickly browse important tidbytes that may be announced... and unnoticed by me if I am not actively following my blog roll.

This post is actually a test to see how it actually works.

ASP.NET Team continues to innovate above Desktop counterparts...

Wednesday, October 08, 2008 7:35:33 PM (Central Daylight Time, UTC-05:00)

For years the ASP.NET team has been out ahead of the WinForms team with innovating features that want to make you use their platform.  They have pushed for features that support common development scenarios (Personalization, Membership, Profile,Site Navigation, Administrative Website, Master Pages and the list goes on and on)   that developers encounter in many of the applications they write. WinForms did have some goodies... but definitely not at the same level, or maybe they just didn't market it like the ASP.NET team.  When you talk about ASP.Net and luminaries at Microsoft, you think of people like Rob Howard (who left a while back to start his own company) and Scot Guthrie.  These two guys promoted the heck out of ASP.Net and its capabilities when it arrived back in 2002.  When you think of luminaries from Microsoft in the WinForms world... well... no one really comes to mind. Remember, I said Microsoft only... outside of Microsoft... Rocky Lhotka and Billy Hollis come to mind.

The ASP.Net team did it again in making it easier to get what you need to build your development environment for developing web applications.  As I contemplated whether I was going to wipe my box tonight, I was searching around to see if anyone had a good method of automating the installation of all the development tools required to develop for the Microsoft web and desktop platforms.  I stumbled across the Microsoft Web Platform Installer Beta...

image

Now if we could just get this through a MSDN subscription, so that we would have access to the actual versions of the tools rather than the Express versions.

image

 

PDC 2008 Futures and the IPhone

Wednesday, October 01, 2008 10:36:02 PM (Central Daylight Time, UTC-05:00)

I had some spare moments today while I was sitting in the waiting room of the doctors office (my daughter wasn't feeling well).  I decided to catch up on some blogs on my iPhone.  As I read through a number of postings... I thought about something I ran into earlier in the day when I was walking by the TV. There was another one of those Windows commercials (Shoe Circus, New Family: Part1, New Family: Part2, I'm a PC: "Pride") on again... this one was different... it wasn't a tease... it gave you a place to go...  mojaveExperiment.com.   It turns out that Microsoft is addressing the the bad press Vista has gotten over the last two years.  The idea behind the site is to tell users that they are about to try the next version of Windows (aka Mojave), but in reality it is really Vista.  The feedback from these participants is interesting... I am not sure they could have pulled this same experiment before Vista sp1.  Especially since one of the participants commented how quick it did things.

The other add campaign that we are now seeing is also related to Microsoft fighting back around the image of a PC.  The guy shown below looks like the actor they have on those commercials... the interesting thing is that he actually is a Microsoft employee.

image

With all of the this marketing hype around the platform were obviously going to see what the next version of Windows is going to look and feel like.  That is a given.  However, I don't think that is all that exciting.  What would be really exciting is NOT to get this:

 Picture1

on my IPhone.

Binding TextBlock to RichText

Wednesday, October 01, 2008 10:16:41 PM (Central Daylight Time, UTC-05:00)

I was doing some updates to a debugging tool for WPF... I was adding a filter feature that would highlight the characters in yellow as you entered them.

image

I was originally using a TextBlock to bind to by information and that worked fine until I was adding the rich text feature of highlighting the search string.  You can't bind to the Text property of a TextBlock and pass in a Inline object (shown below, which is what supports the rich text within a TextBlock).

image

The only time you could pass Inlines to the TextBlock was in the constructor... that wasn't going to work with a binding.

That forced me down the road of investigating the use of a Label, as I could bind to the Content property and it would render the Inline elements I was creating just fine... this resulted in the rich text highlighting.  However, there was a couple of issues... since this is constantly taking information from the Win32 OutPutDebugString call (see DbgMon) it really needed to perform well when rendering.  I was noticing a little bit of a performance hit... not substantial, but noticeable (maybe that is substantial then).   In addition, wrapping text with in a Label turned out to be not so easy. 

So I went back to the TextBlock.  I tried to bind to the Inlines property.  There was a couple of issues with that... one it wasn't a DependencyProperty and the other issue was that it was read-only.

Solution:

Since I had written a converter to handle highlighting of the filtered text within the string, I was returning Inlines. I modified the convert so that I would return a TextBlock and since I was creating the inlines I was able to pass them into the constructor of the TextBlock.  Instead of binding to a TextBlock in the DataTemplate, I binded to a ContentControl, which would intern using the converter to get the TextBlock that was generated with the filter text highlighted.

The resulting converter looked like the following:

public class StringToHighlightConverter :  IValueConverter
   {
       public object Convert(object values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
       {
           //get the data found in the text
           string dataText = (string)values;
 
           if (!string.IsNullOrEmpty(dataText) && !string.IsNullOrEmpty(TextSearchFilter.SearchClause))
           {
               List<StringOccurance> highlightedWords = new List<StringOccurance>();
               foreach(string token in TextSearchFilter.TokenizedSearchClause)
               {
                   highlightedWords.AddRange(StringEx.FindStringOccurances(dataText, token));
               }
               
               if (highlightedWords.Count == 0)
                   return CreateTextBlock(dataText);
 
               int textStartIdx = 0;
               string plainWord = string.Empty;
               int wordOccuranceIdx = 0; //keep count of the words we have proccessed
               Span phrase = new Span();
 
 
               for (int i = textStartIdx; i < dataText.Length; i++)
               {
                   if (wordOccuranceIdx == highlightedWords.Count)
                   {
                       //We have reached the maximum word occurances, add the plain word span
                       Span wordSpan = CreateWordSpan(dataText.Substring(i), false);
                       phrase.Inlines.Add(wordSpan);
                       break;
                   }
 
                   //get the currrent word that needs to be highlighted
                   StringOccurance wordOccurance = highlightedWords[wordOccuranceIdx];
 
                   if (wordOccurance.StartIndex == i)
                   {
                       //add the plain word span
                       if (!string.IsNullOrEmpty(plainWord))
                       {
                           Span wordSpan = CreateWordSpan(plainWord, false);
                           plainWord = string.Empty;
                           phrase.Inlines.Add(wordSpan);
                       }
 
                       Span highLightedWordSpan = CreateWordSpan(wordOccurance.Value, true);
                       wordOccuranceIdx++;
                       //issue with this
                       i = i + (wordOccurance.Value.Length - 1);
                       phrase.Inlines.Add(highLightedWordSpan);
                       continue;
                   }
 
                   if (i >= dataText.Length)
                   {
                       //add the plain word span
                       //Span wordSpan = CreateWordSpan(dataText.Substring(i), false);
                       Span wordSpan = CreateWordSpan(plainWord, false);
 
                       phrase.Inlines.Add(wordSpan);
                       break;
                   }
 
                   plainWord = plainWord + dataText[i];
               }
 
               return CreateTextBlock(phrase);
 
           }
           return CreateTextBlock(dataText);
       }
 
       private TextBlock CreateTextBlock(Inline text)
       {
           TextBlock block = new TextBlock(text);
           block.TextWrapping = System.Windows.TextWrapping.Wrap;
           return block;
       }
       
       private TextBlock CreateTextBlock(string text)
       {
           Span textSpan = new Span();
           textSpan.Inlines.Add(text);
           return CreateTextBlock(textSpan);
       }
 
       private Span CreateWordSpan(string text, bool highlight)
       {
 
           Span wordSpan = new Span();
           if( highlight == true)
           {
               wordSpan.Background = Brushes.Yellow;
           }
               
           wordSpan.Inlines.Add(text);
           return wordSpan;
 
       }
    
       public object ConvertBack(object value, Type targetTypes, object parameter, System.Globalization.CultureInfo culture)
       {
           throw new NotSupportedException("Not supported");
       }
   }

The xaml in the DataTemplate looked like:

<DataTemplate>
    <ContentControl Content="{Binding OutPutDebugString, 
                    Converter={StaticResource highlightConverter}}" 
                    VerticalAlignment="Top" />
</DataTemplate>