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:

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. This comment has been removed by a blog administrator.

    ReplyDelete
  3. This comment has been removed by a blog administrator.

    ReplyDelete
  4. This comment has been removed by a blog administrator.

    ReplyDelete
  5. This comment has been removed by a blog administrator.

    ReplyDelete
  6. This comment has been removed by a blog administrator.

    ReplyDelete