views:

80

answers:

1

Why is my Silverlight 3 setter causing AG_E_INVALID_ARGUMENT exceptions? Here are two code samples. The first throws an exception but th second does not. What am I doing wrong in the first one?

This one throws the exception:

<Grid.Resources>
    <Style TargetType="Button" x:Key="refreshBtn">
        <Setter Property="Content">
            <Setter.Value>
                <Image Source="../Images/list-add.png" />
            </Setter.Value>
        </Setter>
    </Style>
</Grid.Resources>
<Button Style="{StaticResource refreshBtn}" />

However, this one does not:

<Button>
    <Button.Content>
        <Image Source="../Images/list-add.png" />
    </Button.Content>
</Button>

How do I make the first example work?

A: 

I managed to find working example code here:

http://forums.silverlight.net/forums/p/148685/331275.aspx