What’s New in WPF Beta 2?


If you’ve not noticed that today is a pretty significant day for Microsoft, you’ve either been offline from the major news sources or we’ve lost your attention altogether. I can’t think of many occasions in my Microsoft career when we’ve released so many new things simultaneously. Here are a few links:



One resource in particular that I’d like to draw to folks’ attention is the Windows Vista product guide – an extremely comprehensive overview of the several thousand new features we shipped in this release. It will hopefully dispel once and for all the myth that Windows Vista is just Windows XP with some tweaks to the user interface. Sure, it’s been a rocky ride to this point, but Beta 2 marks a point where I’d say we are now firmly on the glidepath to release.


For those of you who are porting Avalon WPF code forward from our last release (the February CTP), you’ll be pleased to know that the changes are mostly fairly trivial.
The big new feature is performance – this release shows the
benefits of the last three months of intensive efforts to reduce working set and
remove redundancies in the code. You should see significant benefits: as an
example drawn from my own experience, the
Allscripts
patient monitoring
demo that used to run embarrassingly poorly on my
two-year old laptop now runs super-smoothly: enough that I was able to
demonstrate it with confidence on the same machine at a CIO summit keynote a
week or two ago.


As I’ve gone through our portfolio of samples, there are a few changes that have stood out,
however: I’ve tried to enumerate most of them here.


Slider / ScrollBar Style Changes
We’ve made changes to the Track primitive class that is used in the styles of ScrollBar and Slider to make it simpler for tools like Expression to modify (you no longer need to create a new style to edit a single property on the Thumb or RepeatButton controls that make up a Track). The following sample code shows the new syntax:


<Track
Name="PART_Track">
 
<
Track.Thumb>

    <
Thumb
Style="{DynamicResource
Slider_Thumb}
" />

   </
Track.Thumb>

  <
Track.DecreaseRepeatButton>

    <
RepeatButton>

      <
RepeatButton.Resources>

        <
Style
BasedOn="{StaticResource
Slider_RepeatButton}
"

               TargetType
="{x:Type
RepeatButton}
">
         
<
Setter
Property="Command"
Value="Slider.DecreaseLarge"
/>

        </
Style>

      </
RepeatButton.Resources>

    </
RepeatButton>

  </
Track.DecreaseRepeatButton>

  <
Track.IncreaseRepeatButton>

    <
RepeatButton>

      <
RepeatButton.Resources>

        <
Style
BasedOn="{StaticResource
Slider_RepeatButton}
"

               TargetType
="{x:Type
RepeatButton}
">

          <
Setter
Property="Command"
Value="Slider.IncreaseLarge"
/>

        </
Style>

      </
RepeatButton.Resources>

    </
RepeatButton>

  </
Track.IncreaseRepeatButton>

</
Track>

Z-Ordering for Panels
This is the kind of change I like! We've added an attached
property for panels that allows you to control the z-order of elements contained
within them. The absence of this feature has been painful for a number of our
customers and partners (in the past, z-ordering was determined by the order of
objects in a collection, meaning that you had to remove an object from a
collection and re-insert it, with all the associated overhead of doing that).
It's great that we've been able to fix this in time for the first production
release of WPF. Simply check out the Panel.ZIndex attached property.

XAML Syntax Tightening
We’ve tightened up XAML syntax in a few places. One common example
where you may start seeing a build error is in code where you use x:Name inside
a subclassed container panel if you also use it in the subclassing itself. If a markup subclassed element (defined in one scope, aka the definition scope)

was used in another scope (aka the usage scope) and it had names on elements

under it in the usage scope, there exists a potential conflict of these names

wherein name fields would be created for these in the outer (usage) scope, but

the parser would actually register the names in the inner scope (since it would

implicitly acquire a namescope dynamically in the definition
scope). and give names to because we can't easily detect name clashes of this
kind at compile time.

Another XAML change is that resources can no longer be forward referenced.
For example, if you have a data template that references a control template with
an x:Key of foo, then foo must be declared before the data
template.

Windows Forms Integration
ElementHost and WindowsFormsHost
now contain a Child, rather than a
Children property, since they can only have one child (poor things…). A few of
the other methods like FirstChild are also removed, since they're no longer
necessary. This should be a straightforward fix.

Those are all the changes that I've run into so far – I'll supplement this
list if I come across anything else that’s worthy of note. Let me know if you’re blocked by anything else and I’ll do some digging.


Comments (18)

  1. ppavan says:

    Hi Tim,

       I tried installing the WinFX RC Beta 2 but it keeps failing. Here are the error log entries:

    [05/23/06,22:38:00] Windows Communication Foundation Beta 2: [2] Error: Installation failed for component Windows Communication Foundation Beta 2. MSI returned error code 1603

    [05/23/06,22:38:37] WapUI: [2] DepCheck indicates WinFX Runtime Components 3.0 Beta 2 was not attempted to be installed.

    Any suggestions? I even posted on Channel9 but no replies yet 🙁

  2. Anonymous says:

    Is out the door … For breaking changes and &quot;what’s new&quot; information, check Tim Sneaths post

    If you…

  3. MSDN Archive says:

    Are there any wise words about installation order you could share?

    PS "Super-smoothly"? Time for some linguistic detox back here in Blighty eh? 🙂

  4. Anonymous says:

    It would help if I could actually download product keys from the MSDN site to install the beta.

    The servers can’t handle the load and are generating error messages when product key requests are made.

    MSDN costs money – why haven’t MS anticipated the load and made the necessary arrangements.

    I’ve recently completely lost faith in MS and this probable train-wreck of an operating system.

    MS staffers appear to be more concerned about free towels than delivering a service to windows and MSDN users.

  5. Anonymous says:

    Tim Sneath tells us whats new in WPF Beta 2, and where to get just about everything!

    Martin

  6. Anonymous says:

    Hi! As you can read right here: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=421854&SiteID=1

    I found out that the ScreenSpaceLines3D class is obsolete. This is a major drawback for me. (Take a look at the screenshot in the forum thread)

    Do you have any suggestions how to fix this?

    Thanks!

  7. Anonymous says:

    OK, the only thing I had to change was the missing of "MyApplication" object. I needed to close my app from another window, so I used this object. Now [MyApp].Current.MainWindow.Close() does the work.

  8. Tim Sneath says:

    "super-smoothly" – oh dear – I don’t even realise I’m doing it… well, obviously you should be super-excited that we’re leveraging the _awesome_ investments we made earlier in the cycle, and we’re now ready to dogfood to the nth 🙂

    In terms of installation order, make sure you’ve removed the old version, and then install the new one? 🙂 Seriously, the rough order should be:

    – Visual Studio 2005

    – MSDN Library for Visual Studio

    – WinFX Runtime Components (if you’re on XP – it’s pre-installed in Vista)

    – Windows SDK

    – Visual Studio Extensions for WinFX

    Hope that super-helps…

    Tim

  9. Anonymous says:

    Ce qui est rassurant dans WPF beta 2, c’est qu’il y a peu de nouveaut&#233;s ! Conform&#233;ment &#224; ce qui avait…

  10. Anonymous says:

    Currently, I am struggling with WinFX and I must admit that I do not like the way how WPF (Windows Presentation…

  11. Anonymous says:

    Hello, Tim.

    Unfortunately, I’ve ran into that "XAML Syntax Tightening" thing and it seems I have no idea how to fix it.

    To be more specific, I have a subclassed TabControl that has x:Name for elements in the definition scope, and now I get a build error because of the names on the elements under it in the usage scope, exactly as you described above. So what is the solution to this issue?

    I hope you have a little time to enlighten me. 🙂

    Thanks, Daniel.

  12. xpectworld.com craig kelly-soens says:

    hi tim

    hows things?

    craig kelly-soens here,

    The UK is still wet and the sun has not shone for weeks now, im sure you miss it all !

    im getting the following error, on winfx MayCtp06 runtime install,  i thought i’d post it asap, il also post any resolve, but it appears to be WCF based.

    (i’m installing may 06 CTP to complete my "long-time-coming" WinFx-WPF architecture article, yes im still on about it !)

    error below

    cheers,

    c

    [05/26/06,13:45:55] Windows Communication Foundation Beta 2: [2] Error: Installation failed for component Windows Communication Foundation Beta 2. MSI returned error code 1603

    [05/26/06,13:47:28] WapUI: [2] DepCheck indicates WinFX Runtime Components 3.0 – Beta 2 was not attempted to be installed.

  13. xpectworld.com craig kelly-soens says:

    hi,

    with credit to the Avalon team for the answer the solution is indeed in the section titled

    2.7 WinFX Beta 2 installation fails on a system with WinFX Jan CTP or earlier previously installed

    of

    http://msdn.microsoft.com/windowsvista/support/relnotes/winfxbeta2/default.aspx

    but to save you time just type in

    sc delete "InfoCard Service"

    (IMPORTANT: i mean type in – if you paste it your quotes may not be right)

    and then re-run the install

    it worked for me….after i actually typed it !!

    cheers,

    craig kelly-soens – Windows Vista WinFx XAML .Net Technical Evangelist

    http://www.XpectWorld.com – customised "super-easy to use" Windows Vista based .Net software & consultancy and the Xtensions Customer Xperience Manager database

  14. Anonymous says:

    ScreenSpaceLines3D super blocks my development. Please post workaround to get same functionality.

  15. Anonymous says:

    As Tim mentions, in beta two we don’t support any form of forward references using StaticResource.&amp;nbsp;…

  16. Anonymous says:

    In recently porting some code to Beta 2 of WPF, I hit one of the XAML Syntax Tightening changes that…

  17. Anonymous says:

    "XAML Syntax Tightening…

    you may start seeing a build error is in code where you use x:Name inside a subclassed container panel if you also use it in the subclassing itself"

    Does this mean that we cannot add elements in a container inherited from WPF container in XAML anymore if we want to use them in C# file?

  18. Anonymous says:

    Ce qui est rassurant dans WPF beta 2, c&amp;#39;est qu&amp;#39;il y a peu de nouveaut&amp;eacute;s ! Conform&amp;eacute;ment