Thursday, March 19, 2009

Bug: Explicit Styles Replaced by ISM in Silverlight3 Version of Toolkit

As many of you are aware we've just released a new version of the Silverlight Toolkit.  Rest assured it is a high-quality release that is chock full of great new controls and compelling features.  Unfortunately a bug in the SL3 version of ISM slipped through.  This bug causes ISM to replace styles you've explicitly set.  This issue also affects the themes. 

Given the following XAML...

<Grid theming:ImplicitStyleManager.ApplyMode="Auto"> <Grid.Resources> <Style TargetType="Button"> <Setter Property="Foreground" Value="Green" /> </Style> <Style x:Key="customStyle" TargetType="Button"> <Setter Property="Foreground" Value="Red" /> </Style> </Grid.Resources> <Button Content="This should be red." Style="{StaticResource customStyle}" /> </Grid>

...ISM should ensure that the style explicitly set on the button takes precedence over the other style in the Grid's resource dictionary.  Unfortunately it replaces the explicit style with the implicit one:

shouldbered

The good news is that you can replace the references to the System.Windows.Controls.Theming.*.dlls in the Silverlight 3 Toolkit with the ones in the newest version of the Silveright 2 Toolkit (available here) and everything will work just fine.  You will still get access to all the new themes and bug fixes.  In fact there is no difference between these two assemblies other than this bug.

Sorry for the inconvenience.

6 comments:

Anonymous said...
This comment has been removed by a blog administrator.
Affordable Luxurious Wedding Dress Blog said...
This comment has been removed by a blog administrator.
Nightlife Web Directory said...
This comment has been removed by a blog administrator.
Advertising Agencies said...
This comment has been removed by a blog administrator.
Anonymous said...
This comment has been removed by a blog administrator.
Anonymous said...
This comment has been removed by a blog administrator.

About Me

My photo
I'm a software developer who started programming at age 16 and never saw any reason to stop. I'm working on the Presentation Platform Controls team at Microsoft. My primary interests are functional programming, and Rich Internet Applications.