Have you ever used a resource in the Visual tree of a control just to hold a data object which you can access later in an Item Template.

For example:

<Grid>
    <Grid.Resources>
        <ContentControl x:Key="BindingContent" Content="{Binding}" />
    </Grid.Resources>
    <ListBox>
        <ListBox.ItemTemplate>
            <DataTemplate>
                <TextBlock Text="{Binding MyProperty}"
                           Foreground="{Binding Path=Content.MyProperty2,
                           Source={StaticResource BindingContent}}" />
            </DataTemplate>
        </ListBox.ItemTemplate>
    </ListBox>
</Grid>

In this example, the Textblock has a foreground bound to a data object residing in a resource. Everything works fine in the above example and runs as expected in Silverlight 4.

In Silverlight 5, this “workaround” just stops working. This is due to a bug fix in Silverlight 5.

More details at Silverlight 5 Incompatibility: Play by the Rules by Jeremy Likness.

Advertisements

Share your thoughts

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s