Jaime Rodriguez
On Windows Store apps, Windows Phone, HTML and XAML

  • Jaime Rodriguez

    What is new in WPF and Cider on the .NET Framework 4 and VS2010 beta 2 release


    This post is a quick recap of the most important changes for WPF and Silverlight developers in this Beta 2 release. I definitely will return to a few of these topics over the next few weeks, so stay tuned for updates and new posts. Please note that this post is NOT all-inclusive; there are lots of features and smaller bug fixes that I am leaving out. I will try to dig those up as we go along in the next few weeks!

    Also, I've listed links to the Beta 1 posts at the bottom of the post for those needing a refresh. I've also sprinkled links to the videos in our “WPF in VS2010 Beta 2 series” throughout the post, as well as listing them at the end.

    New in the Visual Studio 2010 Cider designer

    You can see a video with most of the Beta 2 updates in this 14 minute video with Mark Wilson Thomas.
    In the video, Mark shares a MUST USE registry key to improve the performance of Visual Studio 2010 Beta 2.

    For the record, this is in the readme, it is not a hack and Mark has documented it on his announcement:

    Registry Switch for improved performance
    Because of a late-breaking change, you will need to make a configuration change to see the best designer performance. This configuration change will not be necessary in the final released versions of the product.
    NOTE: Editing the registry can cause serious problems that may require you to reinstall Windows. Microsoft cannot guarantee that problems resulting from the incorrect use of Registry Editor can be solved. Use Registry Editor at your own risk. Refer to the article on registry editing for your OS (e.g http://support.microsoft.com/kb/136393) for advice. 
    1. Close any open VS instances
    2. Open RegEdit (as an administrator as needed)
    3. Select the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0 key
    4. Right click and add key, type ClrHost
    5. In the newly created key, right click and add a DWORD32 with the name StartupFlags
    6. Set its value to 5
    7. Close RegEdit
    8. Start up Visual Studio and use as normal

    [10/28 update. Mark now has a disclaimer and it is in bold red on his page, so it must be important, go read it:

    1. The registry hack might create instability or increased Virtual Memory Usage in some VS scenarios.  If you see this, feel free to remove the config change and report it on Connect.
    2. Also, if you are not using Cider designer a lot (for WPF and Silverlight) the configuration change is not helping you. So don't enable it unless you are using the designer a lot. ]

    Here are my cliff-notes from the video:

    For WPF developers

    • The designer continues to stabilize.  All the features introduced in Beta1 – including improvements on the designer, brush editor, IntelliSense on binding markup extensions, data sources window- have been cleaned up and the performance has been boosted. 
    • The property browser has been updated with a new view that tells you what is the source for the value of a property (e.g. is the source set locally, from a style, binding, etc.).   This feature is proving incredibly handy based just on my one week of using it!
    • Support for StaticResources in app.xaml. Finally! No more long pack://application,,,/ syntax required.
    • Improved error handling, much like Blend, where the designer can isolate errors to a specific user control; the designer now ‘recovers’ and gives you meaningful information about the error.
    • Now there is design-time data support; compatible with Blend. 

    For Silverlight developers,

    • You finally get an interactive designer where you can drag & drop and get all the designer features available in WPF -  zero to 70 MPH in a single release- Cha-Ching!!

    New Graphics (minus text) features for the WPF run-time?  
           You can watch demos for most of these in this video with David  Teitlebaum.  You can get the demos for this video here.

    • Cached Composition. This feature allows you to “cache” any UI Element as a bitmap that can be persisted in video memory. The cache supports dirty regions, so it redraws when needed (with out you needing to detect it).  
      Cached elements can be live objects (e.g. a textblock) and can be transformed, rotated, etc.
      This feature is incredibly powerful for WPF scalability. If you watch David’s video you will see how he went from ~10fps on a live drawing, to 60fps when he cached it. I recently had a similar experience in a 3D viewer; my CPU decreased by 80% for all my drag & drops once I cached the 3D scene during the drags.
    • Layout Rounding allows WPF to avoid the blurriness that results in images and text when they are using layout with sub-pixel positioning.  This feature is in Silverlight 2; again, nice to have compatibility.
    • Pixel Shader 3 support expands the effects pipeline significantly since PS3 has a lot more instructions. A good reference on difference on # od instructions between PS2 and PS2 is at wikipedia.
      Note: The gotcha for this features is that Pixel Shader 3 does not default back to software rendering, so you will need to test to see if hardware supports the feature before you use it.
    • Animation easing functions allow designers to create more realistic, fluid animations. This feature matches the easing functions in Silverlight 3 and provides XAML compatibility.  Out of the box, you get  CircleEase, BackEase, ExponentialEase, Quadraticease, CubicEase, QuarticEase, Quinticease, PowerEase, Elasticease, BounceEase, and SineEase.  There is also an interface (IEasingFunction), so you can create your own easing functions and plug them into any of the existing animations via a new Dependency property on all stock animations. 
    • RenderOptions.ClearTypeHint allows you to turn ClearType on in scenarios where the system previously turned it off.

    New Text Features
    You can watch most of these improvements with insightful explanations in this Channel9 video with Chipalo Street.

    • A new text rendering stack improves the clarity and puts  the application developer in control of the rendering and formating options. With this new stack you choose between the old world WPF text (which worked well for some scenarios), and new text with comparable sharpness to Win32/GDI. 
      Configuring the text enhancements is handled mostly via two new attached properties:
      • TextOptions.TextFormatingMode allows you to control the metrics for formatting text. You get two options:
        • Ideal – is the old WPF, the glyphs maintain high fidelity with their outlines, and placement of the final glyph is not taken into account
        • Display – uses GDI compatible metrics and ensures glyph widths are in whole pixels (clarity of the text is much higher when text aligns to whole pixels)
      • TextOptions.TextRenderingMode allows you to control how the text is rendered.
        • Auto – respects the system setting; this is usually ClearType for most systems
        • ClearType – forces the rendering to Cleartype -this is what we were doing in earlier versions of WPF
        • GrayScale – renders grayscale, antialiased text
        • Aliased –  no antialiasing is used.
          Note: Per Chipalo, aliased vs. antialiased does not lead to perf differences; this surprised me.
    • Embedded bitmaps adds support for (mostly) East Asian fonts that contain bitmaps for some characters at small sizes.
    • Bindable Run is simply the old Run, fixed so that Run.Text is a dependency property and can be data bound.
    • Customization support for Caret Brush allows you to replace the Caret in TextBox, PasswordBox and RichTextBox. You can replace the CaretBrush with any brush. Go crazy!  You can also customize SelectionBrush and SelectionOpacity on all controls that support selection –including TextBox, RichTextBox, PasswordBox, FlowDocumentPageViewer, FlowDocumentScrollViewer and FlowDocumentReader.
    • Custom Dictionaries allows you to customize the dictionary used for spell checking in WPF applications. In previous releases, WPF used the OS dictionary, but did not allow you to extend it. Now with Custom dictionaries you can extend the dictionary to include your specialized industry lingo. 

    New Control & Data binding features

    • VisualStateManager support. VSM actually ships in the platform and all the controls have been tweaked to support Visual States. This means you can now customize Control templates using VSM and get higher compatibility with Silverlight.
      Note: Despite the VSM support in all the controls, the actual control templates were not changed, you will need to replace the template to use VSM.
    • Inheritance Context for Input Binding enables the MVVM scenario of  binding InputBinding.Command to a command in a ViewModel.  The Key and Modifiers property in KeyBinding are now Dependency Properties; same for MouseAction and MouseBinding.
    • DependencyObject.SetCurrentValue  is a new method introduced mostly for Custom Control authors.  SetCurrentValue method changes the effective value of the property, but existing triggers, data bindings, and styles will continue to work because the ValueSource for the property is not changed.  A lot of the controls in WPF were tweaked to use this, so their old SetValue calls were replaced with SetCurrentValue. I hear the recommendation is for custom control authors to use this method instead of SetValue; reccomendation makes sense, I am not sure if it applies 100% of the time, or just 99%; so use with 1% caution.
    • Databinding support for DynamicObjects.  With .NET 4’s support for dynamic keyword, a lot of people will be using DynamicObject (and I DynamicMetaObjectProvider).  You will be able to bind to these dynamic objects using the same syntax than a property of any other object. You will even be able to use typed DataTemplates (as long as you are using concrete typesthat derive from DynamicObject.

    New Windows 7 features

    • MultiTouch is fully functional in Beta2. WPF now has full support for multitouch including  manipulation, inertia, and raw-touch events.   The support is at UIElement, UIElement3D and ContentElement –which means every thing with LIFE in WPF supports Multitouch. 
      This topic is going to get its own blog post (and hopefully a video) soon, so stay tuned.
    • Taskbar support for Windows 7, including jumplists, progress bar, overlay icon, and thumbnail buttons (with WPF commanding support).  This topic will also get its own blog post soon.

    Deployment update
    You can watch a demo and get the whole picture from this Channel 9 video interview with Jossef Goldberg.

    • Client profile is critical to the deployment of the framework outside of managed enterprises. By subsetting the full framework to a client SKU, we will decrease download size, and improve the framework install times. 
      In Beta 2, client profile is near feature complete:
      • You can see it as its own separate, serviceable SKU
      • The tools have support for it, including the References dialog in VS2010 filtering for assemblies only in client profile SKU if that is what you are targeting. 
      • A few assemblies that were not in client profile SKU are now included, this increased the size to 30 MB, which is still a great improvement compared to full framework. 

    Hopefully this gets you caught up on beta2.  Time to play! Download visual Studio 2008 beta2.  Stay tuned for a few more posts on the topics above.


    Beta 2 links:

    Beta 1 (but still relevant links)

  • Jaime Rodriguez

    Implementing Aero Shake in a WindoStyle None WPF Window


    I just tried to implement Aero Shake in a WindowStyle=None WPF window.

    I had no clue what I would need to do; I figured I had to start by dragging the Window..   tried that, ran it just to see what would happen and voila! Windows 7 did the rest… 

    I am going to the movies (since I had budgeted 3 hours for this)..   Thanks Windows 7 Shell team!

    <Window x:Class="WpfApplication40.Window1"
    Title="Window1" Height="300" Width="300" MouseLeftButtonDown="Window_MouseLeftButtonDown"
    Opacity="0.5" WindowStyle="None" AllowsTransparency="True" >

    TextBlock Text="Shake me.. please" VerticalAlignment="Center"
    HorizontalAlignment="Center" FontSize="60"/>


    private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
  • Jaime Rodriguez

    Platform Update For Windows Vista


    Windows 7 is packed with lots of new “developer” or “platform” features

    We are confident most customers would benefit (better per, better UX) from running on Windows 7;  but we also acknowledge that adopting a new OS is not always immediate (specially for any large enterprise that recently rolled out Windows Vista). 

    For developers whose customers can’t move to Windows 7 immediately, Microsoft recently announced the “Platform update for Windows Vista” beta.

    The Platform Update for Windows Vista, brings a lot of the  Windows 7 goodness into previous OSes (Windows Vista and Windows Server 2008); the update includes Direct2D, Direct3D, DirectCompute, Windows Imaging Component (WIC)DirectWrite, XPS , and the Windows Ribbon) . 

    You can learn a lot more about the Platform Update here.  


  • Jaime Rodriguez

    More on AERO Shake and WPF


    A few follow-up questions (and answers) from this post on Aero shake in WPF Windowless apps .

    The code I posted does not work if your WPF WindowStyle=None window is maximized. Why is that?

    The shell detects the shake based on Windows movement, and when a window is maximized, it can not be dragged. This is a behavior defined by the shell :(

    Can’t you just ‘detect’ mouse move events and identify the shake gesture and then call the Shell’s API to do the shake?

    Unfortunately not.  The shell does not publicly expose APIs to implement the shake behavior – which is minimizing all windows except for the one that is being shaken-.

    Are we out of luck then to get Aero Shake on a ‘full screen’ app?

    I think that simulating shake (several posts on the web that do that) is not ideal.  Those posts do it to bring Shake to earlier versions of Windows that do not have it.   What I advised the person that did it was to not maximize their Window.  You can detect the available screen real-estate and size to that.

    this.Width = SystemParameters.FullPrimaryScreenWidth;
    this.Height = SystemParameters.FullPrimaryScreenHeight
              + SystemParameters.CaptionHeight;
    this.ResizeMode = ResizeMode.NoResize; 

    To most users (who are not looking to shake),  the window will still look like it is maximized. No difference.
    To a user that is looking to shake, the window can be moved (and shaked).  The mere idea of ‘shaking’ a full screen window is not very common, but in this case the app was partially transparent so it did need it.  All I did was allow the shake again using DragMove, and then resetting the position of the window back to 0,0 after the shake. 


    private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
                this.Left = 0;
                this.Top = 0; 

    I am not claiming this is a best practice, but it worked good enough for my expectations.  If you want to see the code and decide if it works for your scenario, you can download a sample app from here.

    Why the emphasis on WindowStyle=None, does Aero Shake work on WPF apps with standard windows?  

    Aero Shake works fine with standard WPF windows;  no changes are needed to your WPF apps.  It is the windowless apps that needed the few lines I have shared in these posts. 

    At last, if you do not know what Aero Shake is, you can watch shake in action in this 15 seconds video.

  • Jaime Rodriguez

    Learn, network with MVPs, and have fun at the PDC Windows 7 Developer Boot Camp


    Before and After

    We recently announced a free, all-day Windows 7 developer training the day before PDC. 

    Our goal for the day is to dive deep into the new most important kernel features, and also give you insightful advise into the new user mode developer features – including multitouch, taskbar, sensors & location, and graphics.  The day will be packed with insightful advise guaranteed to save you hours of reading articles, documentation, and blog posts. We are going to be punchy and direct!

    I am also pleased to announced that the MVPs attending PDC are joining us for the day, and are going to be hosting all the attendees for lunch; the lunch tables will have signs announcing the MVP technology to be discussed at that table;  you can drill down on that specialty and connect with our community champions and most valuable professionals.

    We are also adding to the boot camp the judging competition for the Code 7 contest; this will be a fun 30 minutes near the end of the day, you will see some very cool, inspiring Windows 7 projects developed by the community, and we will also have a few prizes to raffle for the boot camp attendees. 

    If you are still not ready to go home after all that,  you can hit the recently announced screening of the Visual Studio Documentary. 

    As you can see, the day is packed with great content, experts, and fun activities.  All of this for the low price of FREE!!
    You do still have to register.  All the details for the free registration are here. You do not have to be attending PDC, you can register for just the boot camp.  Of course, if you are coming to LA, might as well stay for the full PDC.
    Registration to the boot camp is on first-come-first-served basis, so don’t wait too long.

    About the agenda for the day, it is the same schedule than the workshops: 10 AM to 5:45 PM with lunch at noon and two breaks during the day.

    Our current outline divides the day into three two-hour sessions:

    • 10 AM – noon.  -- Getting the most out of Windows
      Mark Russinovich, Arun Kishan and Landy Wang are going to dive deep into the kernel improvements. Arun is going to demystify the scheduler, and Landy is going to spill all the details on the memory manager improvements in Windows 7
      Yes, I know, these are not the technical terms they would use, but their outline is the kind of deep stuff that makes my (as they call it, user mode) head hurt, so I had to simplify it.  The good news is that Arun, Mark and Landy will also be available after their two hour session for those of you who want to side line with them and keep going deep into their kernel bliss.
    • Noon to 1:15 – Lunch and network with the MVPs
    • 1:15 to 3:15 – Making the most out of your software
      Yochay Kiriaty and I will get deep into the shell improvements – taskbar, libraries and search-; we will also cover,  the new ribbon control, and the sensors & location platform (technically this belonged in the hardware session, but we had to fit it here to optimize the time).
    • 3:45 to 5:30ish – Getting the most out of today’s PC hardware.
      We will cover multitouch and Michael Oneppo will join and dive into the graphics improvements in Windows 7- including Direct2D, DirectWrite,  and DirectX11.
    • 5:30 to 6ish…  Code 7 Contest prizes
    • 6:30 the Visual Studio documentary.

    Again, must register to attend..  Don’t wait too long or you might be left out.

Page 1 of 1 (5 items)