Share via


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

  • Anonymous
    May 23, 2006
    The comment has been removed
  • Anonymous
    May 23, 2006
    Is out the door ... For breaking changes and &quot;what's new&quot; information, check Tim Sneaths post
    If you...
  • Anonymous
    May 23, 2006
    Are there any wise words about installation order you could share?

    PS "Super-smoothly"? Time for some linguistic detox back here in Blighty eh? :-)
  • Anonymous
    May 23, 2006
    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.
  • Anonymous
    May 24, 2006
    Tim Sneath tells us whats new in WPF Beta 2, and where to get just about everything!
    Martin
  • Anonymous
    May 24, 2006
    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!
  • Anonymous
    May 24, 2006
    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.
  • Anonymous
    May 24, 2006
    The comment has been removed
  • Anonymous
    May 24, 2006
    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...
  • Anonymous
    May 24, 2006
    Currently, I am struggling with WinFX and I must admit that I do not like the way how WPF (Windows Presentation...
  • Anonymous
    May 26, 2006
    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.
  • Anonymous
    May 26, 2006
    The comment has been removed
  • Anonymous
    May 26, 2006
    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
  • Anonymous
    May 26, 2006
    ScreenSpaceLines3D super blocks my development. Please post workaround to get same functionality.
  • Anonymous
    May 26, 2006
    As Tim mentions, in beta two we don't support any form of forward references using StaticResource.&amp;nbsp;...
  • Anonymous
    May 30, 2006
    In recently porting some code to Beta 2 of WPF, I hit one of the XAML Syntax Tightening changes that...
  • Anonymous
    June 15, 2006
    "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?
  • Anonymous
    September 17, 2006
    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