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

  • Jaime Rodriguez

    MIX09 Recap series part2 , what about WPF


    In between all the positive feedback at MIX, there was a lingering question that I read a lot on twits, blog posts, and heard at the Q&A from some sessions and I think we missed it during our planning; I felt it is one of those “we can not see the forest cause the trees are on the way” mistakes.   Do you know what the question is??  

    Yes, it is “With Silverlight out of the browser, is WPF dead?” ..

    Here is my personal take as a person who spends a lot of time with both of these teams and with customers using the technologies ( very often at the same time):

    WPF and Silverlight address different scenarios and though they look alike, it is unlikely that in the short-term, one replaces the other.

    The long answer is that the scenarios each technology addresses are different enough that they have conflictive requirements.  
    I see the choice between these two platforms as a trade-off between:

    Size vs. Features
    Full-trust (with native interop) vs. Secured or Sandboxed

    Expanding even further:

    Silverlight addresses our RIA needs. A good Rich Internet Application (RIA)run-time needs to be:

    • Cross-platform.  This likely means the frameworks can’t become too exploitive of OS specific features and can’t integrate that well with the host OS. It is a lot of work to create a comprehensive application  framework (like .NET) for cross-platform.
    • Easy to deploy and small in size.  Web technology needs to install quickly, and with no risk of disrupting the desktop.  When it comes to RIA frameworks, the trade-off between features and size is very tough. Compromises must be made when necessary (backing up my point that the framework is unlikely a full-desktop application replacement due to the size constraint).  
    • Secured (or better yet, sandboxed).   Internet software can’t be easily trusted because today there is no easy way to assign different trust levels across the internet.  It is better to run sand-boxed so users are safe, than to put desktop at risk, so most RIA software is therefore sandboxed. This is critical to the success of RIAs! 
      You can ignore it and get lucky (for a little while) but I think it will eventually bite those that do ignore it.  Microsoft has learned that lesson before, and we are not looking to compromise that again (ever?).  
    • Faster and richer than any thing standards and web-based software (else why use it?).

    WPF addresses our Windows (desktop) application needs.  A good desktop application needs to be:

    • Exploitive.  If it runs on a single OS, it better take advantage of it. Features like desktop and shell integration, drag & drop, hardware acceleration, etc.   If the software runs on a platform that supports extended features like touch (in Windows7 or Surface), the app should embrace and support the features.
    • Comprehensive and Powerful. If the run-time is installed once,  there is no reason for it not to be a full framework ( full 3D, media, documents, accessibility, storage and databases, a complete end-to-end  framework that is not constrained by size). 
    • Trusted, verifiable, and secured.  If some one is installing software in their desktop,  they should verify who it came from and then (if needed) trust it to do its job.  If the application needs access to file system, devices, secure stores, sockets, etc.  this is the choice you make at install time; the goal is to trust the application to do its job. You installed the client run-time for that reason. If needed, the run-time can do work to ‘constrain’ the application’s permissions (like Partial Trust). Apps should explicitly declare intent and the permissions they require to run.
    • Easy to deploy/Easy to update/configurable.  I am not aiming for <30 seconds and < 5 MB download like a RIA run-time, but I have to admit Microsoft needs improvements on this.  I am optimistic here:
      • We recently added .NET 3.5 SP1 to Windows Update and hope that over time we get the majority of Windows boxes to 3.5 SP1.
      • With .NET4 we deliver on the vision for client profile.  It will be a 22 MB download, that runs side-by-side with all the other versions of .NET framework, so we will be able to use it on any box (not just clean XP like we have in Client profile with 3.5 SP1). 
        I hope the two combined get us to desktop ubiquity so people can plan a .NET app with out worries about how to install the run-time.
    • Manageable.  When we are talking desktop/enterprise software we quickly get into thousands of users,  controlled versioning, policies, software is centrally distributed , etc..  Desktop software that is installed is easy to manage.  RIA software that can be in caches, user stores, etc. is a bit harder.

    Once you look at the above, it is easy to grasp why today, we do need multiple technologies to address both scenarios. Any one that tells you otherwise is heavily short changing you in one of these two scenarios (usually the desktop).  

    We do need to acknowledge that RIAs need stickiness, and off-line launching, and that is why Silverlight Out Of Browser was created, I call this scenario the “off-line RIA”; and it is very, very different from the “full-trust desktop app”.

    Three more reasons to explain why WPF will be around for a long while: 

    • WPF adoption is going well. We have a lot of partners doing WPF. If you went to PDC, we did a video with just a few of the partners doing WPF, it included Lenovo, HP, AMD, Autodesk, T-Online, Disney, Blockbuster, Roxio, SNCF, SAP, Terra, Cewe, and many others.   These are the types of partners that use WPF to connect with millions of users.  We have equal number of successes in the enterprise with partners who buy lots of Windows licenses and are very important to Microsoft.  We are not walking away from that any time soon.

    Inside Microsoft adoption is also strong;  we see our business platform – the Dynamics team- using it; we have consumer apps like LifeCam and SongSmith, we have office apps like Semblio, our internal IT teams are using it, and our own development division is betting heavily on WPF to create Visual Studio 2010 and Expression Blend.

    Announcement:  Starting next Tuesday (seems like a good day for recurrent series) I will try to start a new “blog series” similar to Tim Sneath’s “Great WPF applications” series; I am not as eloquent as Tim, but I am happy to keep you on the loop on some of the great WPF apps out there. I don’t think we do enough of sharing those successes(again, trees blocking the forest).

    • We are investing into the platform. You did not see that at MIX because most of the announcements were at PDC and we are now in the middle of the .NET 4 release, but you can watch Kevin Gjertadt’s MIX session and hopefully get the message that:
      • WPF will make the most important developer features in Windows 7 accessible to .NET developers.  We are talking Touch!! that is not a small feature. We also have ribbon, taskbar, etc.
      • We continue to improve the fundamentals. Performance and Text are good examples of significant investments in the .NET 4 time-frame. 
      • We thrive to improve deployment so every one can get full .NET Framework applications with much less friction. Details above.
    • WPF is the recommended UI stack in the .NET framework. There are a lot of people that need the full framework for their applications (Workflow, advanced Web services, encrypted stores, Office integration, parallelism, MEF, etc.)  Silverlight is a high-fidelity subset of the framework, and it serves quite well all RIA needs, but we can’t cram the rest of the framework into Silverlight.

    In closing,  WPF will be around a while.  One size does not fit all, today. 

    • It is fair for MIX attendees to wonder about which one to choose, but that is mostly because MIX is a web conference.  These attendees do need off-line, sandboxed RIAs and I am totally psyched that we are able to meet their needs. 
    • For the other customers that need desktop applications that call native Win32 code, access to devices, or integration with desktop and office, then those customers will be able to use WPF.

    The story on the WPF and Silverlight convergence is actually much better than this post discusses because here I aimed at explaining the different scenarios each addresses; stay tuned for Part 3 to discuss the synergies amongst Silverlight and WPF.

  • Jaime Rodriguez

    two very promising WPF application frameworks on codeplex


    Catching up on my blog reading, I see two great development frameworks recently posted in Codeplex. Both aim to build clean, testable, loosely coupled WPF applications with separated concerns.  gift

    • Onyx is a framework that aids in the development of WPF applications that follow the Model-View-ViewModel (MVVM) pattern”, by Bill Kempf

    • "Designed to aid in the development of WPF and Silverlight applications, Caliburn implements a variety of UI patterns for solving real-world problems. Patterns that are enabled by the framework include MVC, MVP, Presentation Model (MVVM), Commands and Application Controller” , by Rob Eisenberg 
    Check them out, share your feedback, use them, join and contribute (if you rejoice in that kinda thing)!

    I am really looking forward to diving into these and to see where the community takes them!

  • Jaime Rodriguez

    WPF blogs


    I recently updated and organized my blog subscriptions. Here is a list (and opml) of all the WPF blogs that I subscribe to.

    Please let me know if I missed yours! Also, don't let me fall too far behind on keeping it up-to-date.


  • Jaime Rodriguez

    WPF effects Library running in Silverlight 3


    At MIX last week, we announced that Silverlight 3 supports effects, written in HLSL 2.0 ..  

    If you remember from this previous post, we have a codeplex WPF library with 20+ effects and greater number of  transition effects.  Charles Bissonette, in the Blend team ported the library to Silverlight, and we have now merged it into codeplex.  

    The effects included in this first release are:
    BandedSwirl, Bloom, BrightExtract, ColorKeyAlpha, ColorTone, ContrastAdjust, DirectionalBlur, Embossed, Gloom, GrowablePoissonDiskEffect, InvertColor, LightStreak, Magnify, Monochrome, Pinch, Pixelate, Ripple, Sharpen, SmoothMagnify, Swirl, Tone, Toon, and ZoomBlur

    The transition effects include:
    BandedSwirl, Blings, Blood, CircleReveal, CircleStretch, CircularBlur, CloudReveral, Cloudy, Crumble, Dissolve, DropFade, Fade, LeastBright, LineReveal, MostBright, PixelateIn, PixelateOut, Pixelate, RadialBlur, RadialWiggle, RandomCircleReveal, Ripple, Rotate, Saturate, Shrink, SlideIn, SmoothSwirl, Swirl, Water, Wave.

    If you have Silverlight 3 and want to see the library in action, click here, or in the image below.


    To play with the sample app:

    1. Select type of media ( vector or image)
    2. Click on the checkbox by the effect name to apply an effect.
      You can apply multiple effects at same time. 
    3. Tweak the sliders and textboxes to configure the effect. 
      Note: the textboxes save changes on lost focus, so will need to tab out and back in.

    My favorite is the transitions.

    1. Click on the top right button to see the show.  Each 3 seconds the transition will change. The first time they repeat twice so you can see the details, later they get random.

    If you do not have Silverlight 3, Adam Kinney and I recorded an impromptu video for you to see watch the demo with out needing to update your bits to SL3).

    Geeking it out (aka the details):

    • Porting the library was trivial,  there is  probably a total of < 50 #if SILVERLIGHT in the project. They mostly relate to dependency properties ( SL does not do UIPropertyMetadata) and or the use of Vector (not in SL, but Point serves the purpose)..
    • SL effects are not hardware accelerated ( due to security) but it performs pretty well on my machine.. Let us know if you see otherwise.
    • Silverlight does not have VisualBrushes,  but you can use the new WriteableBitmap to create a snapshot of a visual ala  RenderTargetBitmap in WPF so you can create cool transitions.   I did it for the start/stop transitions (though I must say I picked some really funky effects for the transitions).

    The source is in codeplex.
    Packaging will likely change. Right now it is WPF project with SL project linking to the WPF files (the way I keep it in source control) but  I think for easier download, it will become separate zips and I can duplicate the files just for releases (source can still be single shared file).  
    Please check the pre-requisites in codeplex, you will need latest DirectX SDK, .NET 3.5 SP1 ( or VS 2008 SP1),  the Shader Effect build task from WPF Futures and of course SL3 and SL3 tools if you want to run the SL bits.

    More effects pictures:
    One Two

                     Pinch + Inverted colors.                                                                           Embossed

    Enjoy, please report bugs/issues if needed.

  • Jaime Rodriguez

    MIX09 recap series part 1, favorite features and announcements


    I am finally caught up with my family and work stuff , so I want to share my belated recap and my lessons learned from observing and talking to people at MIX09.  Since it is a lot, I partitioned it into three posts:

    Part1: Anything that inspired or excited me.
    Part2: What we could have done (or messaged) better; future for our desktop client.
    Part3: Our mission on the client space: The Microsoft Client Continuum.

    Part 1: The good (or great)!

    IMO, this was the best MIX to date.  Microsoft was finally able to demonstrate and deliver the vision we have been thriving for in the last few years:

    • User Experience and designers were embraced throughout the conference (in part, by credible, recognized thought leaders from Microsoft).
      • Bill Buxton and Deborah Adler keynotes were great.
      • Expression Blend announced their upcoming features, with disruptive, rapid prototyping features like sketch flow, and strong improvements to the fundamentals with behaviors, design-time data,  better import tools, and source control.
    • Internet Explorer 8 is a strong return back to the web standards world. It is compliant, more secure, fast enough,  and innovative: IE8 brings safety and productivity to its users.  I think we are back in the game (and just on time).
    • Silverlight 3 came really strong on all angles:
      • We continue to innovate and lead on media.
      • We are moving at warp speed to catch up to WPF around fundamentals (like element to element data binding, resources, etc.) 
      • We are moving towards the enterprise and already have a great set of features planned for the .NET RIA Services; this is the beginning of a great business platform.
      • To every one’s surprise, we let the cat out of the browser (literally!)

    My favorite features announced through out the conference:

    • Blend behaviors – yes, I know this is not even a new technology feature (we have been able to do them for a while) but I think official support in the tools and pre-canned behaviors in the platform will change how designers create interactivity in applications.   Blend behaviors makes designers more productive and empowers them to do all the things that make me “miss” Triggers when I work on Silverlight.  So I am psyched about behaviors.
      To get familiar with behaviors you should:
    • Sketchflow – has the potential to change conceptual design and end-to-end designer workflow.
      I like the direction on which this is going because it enabled rapid prototyping and potential reuse of these prototypes in the real app.

      To get familiar with sketchflow, you must:
      • Watch Christian Schormann’s Sketchflow session.
      • Wait until ? for us to ship the preview. Sorry!

    • All the Silverlight improvements to get parity with WPF:  Official support for Resource Dictionaries,  Styling improvements, Element to Element binding, etc.   I must say these are probably not crowd favorites either, but they are dear to me because I do write code that goes across both platforms, or often I find myself “missing” a feature that was not there in Silverlight; feature parity between both run-times makes it easier to port code and makes Silverlight better (against other competitors) so it helps us increase our user base.

      To get familiar with these improvements, you need to
    • H.264 Media on Silverlight
      This one is big because it allows us to better serve content providers that had H264 format (mostly due to mobile)  so I had to list, but I have mixed feelings here, I still hear ( and can see from videos I get ) that VC-1 is a better format.  Still I am very excited about the possibilities these offers for us to work with new partners!

    Don’t get me wrong, I was psyched about a lot more features than I mention above, but I had to pick a few top ones. If you want the list of other features that really excited me:

    • Silverlight Out of Browser – is very exciting, but I need to see what people do with it.   I have to say it has the potential to be game changing in the long-run (as we grow it).  I will come back to this one in part2 of the series stay tuned for that.
    • New import features in Blend.  Being able to import Photoshop and illustrator sounds very, very good.   I still need to capture feedback from partners on how good it is; if the quality is good, then this will also be game changing.
    • Perspective 3D in Silverlight.  I am still curious where people take this feature too.  I am sure it will be some where great and I will be looking silly for not saying it was game changing ;)

    OK. that is a very high level of all the “Good stuff” ..   I do have to give a “Thank You!” shout to the audience and partners that attended.  For me and lots of other Microsoft folks, a huge part of MIX are the hallway and meals or party conversations.   It is great to hear what we are doing right, wrong, and what we should do next.

    I also have to throw a shout to the Deborah Adler keynote slot. What an inspiring story.

    Stay tuned for part 2 and part 3 in the series!

  • Jaime Rodriguez

    WPF Discussion, 090313


    You know the drill: raw unformatted, Q&A from our internal discussions.

    Subject: RE: ListBox Binding to IList

    When I bind with my own IList/IEnumerable/INotifyCollectionChanged object, I see WPF wrapping it in a collection view of some sort.  When I create the collection view myself and give it to WPF, it seems not to wrap it in another collection view.  Can you tell me (or point me to code) what’s the magic recipe for determining whether-or-not something gets wrapped in a collection view? 


    Everything that is not already a collection view gets wrapped in a collection view.   The basic rule is:
            IBindingList  gets wrapped by BindingListCollectionView 
            IList gets wrapped by ListCollectionView
            IEnumerable gets wrapped by EnumerableCollectionView.

    EnumerableCollectionView is an internal class that takes a snapshot of the underlying IEnumerable, so yes, it enumerates everything.  You can avoid this by exposing IList.   ListCollectionView only enumerates everything if it has to, usually because you applied sorting, filtering, or grouping. 

    Subject: RenderCapability.Tier edge cases

    We are working on using RenderCapability.Tier in Visual Studio as a way to limit visual candy when being run on a low end machine or over a remote connection. My question is, what happens with this property in edge cases, such as a machine having two graphics cards with different capabilities? Does WPF use the capabilities of the lowest card to set the value? Does the value update dynamically if I move my window from a monitor on one card to a monitor on the other?

    It’s the lowest of all the cards.  Dragging your window from one monitor to another shouldn’t trigger a tier-changed event, nor should the result of your tier-query change.

    Subject: D3DImage on XP
    The documentation on MSDN says this:
    “If you are developing for Windows Vista and Windows XP, test the performance on Windows XP. Running out of video memory on Windows XP is a concern. In addition, D3DImage on Windows XP uses more video memory and bandwidth than Vista WDDM, due to a necessary extra video memory copy. Therefore, you can expect performance to be worse on XP than Vista for the same video hardware.”

    The extra mem copy was required because on Vista with WDDM you can create a shared surface and give the D3DImage that, and WPF will read from the shared surface directly.  On XP there are no shared surfaces so WPF has to copy your D3D device’s surface’s bits to its own D3D device’s surface.

    Subject: Remembering previous windows placement and setting that on next invocation

    I have a simple need of remembering the window placement (size, location etc) on the exit of my WPF app and setting the same on the next start of my app. Looks like this involves calling unmanaged APIs using PInvoke as explained in the article at http://msdn.microsoft.com/en-us/library/aa972163.aspx. This seemed little strange for a simple need of mine. I’m just wondering if there is a better alternative (without use of PInvoke) to satisfy my need?

    Window.RestoreBounds combined with WindowState is your friend.

    I would really like to create a seamless browser-hosted experience, so I went down the ‘web service’ middle tier path as Matt suggested below.  Unfortunately, now I’m receiving this SecurityException when attempting to connect to the web service:

    System.Security.SecurityException: Request for the permission of type 'System.Net.WebPermission, System, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

    The action that failed was:
    The type of the first permission that failed was:
    The Zone of the assembly that failed was:
    It looks as though WebPermission is not allowed for partial trust xbaps either.  Are there any known workarounds for this limitation?  Is silverlight my only option if I don’t want a client app and I don’t want to force users to install a certificate?

    An XBAP is given WebPermission to its site of origin. Your exception is likely due to a mismatch between the XBAP’s launching URL (it’s the host:port part that matters) and the URL you are trying to access the web service at.

    Subject: DrawingImage w/ DynamicResource does not refresh properly when in App.xaml

    DrawingImage in app.xaml…    refers to  brush in app.xaml via DynamicResource  …
    When I update the  Brush in App.xaml    { by loading different skin } my image does not pick up the new  brush…  
    This works fine when these two resources are in Window1.xaml …   
    I know that App.xaml freezes the resources , but I checked and  the brush is frozen… that is OK,  I am not updating it, I am replacing it..   The Drawing Image says it is not frozen..

    This is a bug.  I can’t find anything similar in the bug database;   <>, please open a new bug for this.
    The bug arises when you have two application resources X and Y (i.e. declared in your App.xaml), both of the Freezables, and X contains a dynamic reference to Y.    Also, your main tree contains dynamic references to X (but not to Y, except indirectly through X).   If you change Y, say by replacing it, the main tree is notified but nothing happens, since there are no references to Y.

    Subject: How RenderOptions.CacheHint/CacheInvalidationThresholdMaximum/Minimum works?

    I’m working on a project which uses a lot of ImageBrush in the controls.
    Recently, we found by setting RednerOptions.CacheHint to Cache, and setting CacheInvalidationThresholdMaximum/Minimum can improve the performance, I think this improvement is caused by caching the images. But I want to understand the how these 3 properties works in the code. Can some expert explain this to us?

    RenderOptions.CacheHint helped ImageBrushes? Hmm… maybe. ImageBrushes are already cached but it may cause us to skip resampling the original bitmap. It’s meant for brushes with intermediate surfaces (DrawingBrush and VisualBrush) because if you don’t set any caching hints the contents will be updated every time we render the brush.

    The idea is you set CacheHint to Cache to tell us to try to avoid updating the brush. Now if you scaled the brush way up, it could look terrible and if you scale it down it could look bad as well. So min/max thresholds are relative scales to the initial size of the brush that tell us when to update things again. For example, if you set ThresholdMinimum to .5 and the brush size halves, we’ll update the brush and cache the new result.

  • Jaime Rodriguez

    MIX09 recap series part3, The Microsoft Client Continuum


    In  part 2 of the series, I explained the different target scenarios for Silverlight and Windows Presentation Foundation (WPF). 

    I think at MIX09, we could have emphasized a bit more strongly our Microsoft Client Continuum. We demonstrated it a lot, but maybe did not take time to explain it, or explicitly call it,  so I wonder if every one knows about it externally?

    The “Microsoft Client Continuum” is our mission to empower you to create the Best User Experiences across all your customer’s touch points.

    Today, you can reach customers on a web application (RIA), on Windows, on Surface, on Mobile devices, etc. 
    On part 2 of this series, I explained that one single run-time is likely not flexible enough to address the conflicting requirements (size vs. features, or full-trust vs. sandboxed) from all scenarios; if you want to provide the absolutely best experience across multiple touch points, you will likely end up at least compiling the application twice or having small optimizations for each touch point; this is where the Microsoft Client Continuum offers some significant advantages over other solutions. 

    The client continuum uses .NET as the single skill, single toolset needed to create immersive client applications.

    The continuum facilitates great User Experiences with tools that empower both designers and developers; these tools share a common declarative languages to represent UI and interactions.

    The continuum thrives on reuse: skills reuse, tools reuse, and code reuse.


    At MIX09, on the Silverlight and WPF front, we demonstrated the continuum a lot:

    There were plenty other demonstrations of the continuum in action, and there are plenty more to come.  One part that I really enjoyed at MIX was talking to a lot of customers, and partners, who are writing apps that span across the continuum.

    For those wondering about the choice between WPF and Silverlight, keep the continuum in mind and rest assured you are not making the wrong decision with either technology.

    • For developers and designers, learning our continuum technologies is a great investment; you learn XAML and the tools once and you can reuse it across mobile, desktop, RIA, and Surface applications.
    • For businesses, you can prioritize for what you need today (desktop or RIA) and later on create the appropriate companion.  Your skills, tools and code investments are preserved. 

    A few disclaimers on status today and future for the Continuum:

    • We are not done with the Continuum. If you want to share code, do plan ahead; be aware of the current platform differences, expect those to decrease quickly but don’t expect them to go away 100%, Silverlight will likely stay a subset of WPF (to keep it small and RIA optimized).  MIX09 was a great step in the right direction, there are plenty of new features in SL3 that make the compatibility with WPF higher.
    • There will be more convergence on both sides. Both WPF and Silverlight will continue to grow and innovate on their scenarios, but on each release, each run-time should also pickup features that the other run-time added.  WPF will pick up Silverlight features (like VSM or controls) and Silverlight will continue to add features from WPF.  

    Closing the series:  
    I think MIX09 was a great conference!  The features and products announced are very exciting.  Microsoft demonstrated strong innovation and adoption on the RIA space,  and a strong commitment to User Experience and designer tools.  Because MIX09 is a web conference, we shared our web message and this likely confused attendees on our commitment for WPF; the reality is that we are equally committed to WPF and Silverlight, because we need both technologies to deliver on our Client Continuum. 

Page 1 of 1 (7 items)