views:

899

answers:

1

I have this style:

 <Style x:Key="ButtonStyle" TargetType="Button">
            <Setter Property="Template">
             <Setter.Value>
              <ControlTemplate TargetType="Button">
               <Grid>
                                        <StackPanel>
                  <Image Source="{Binding Path=local:AttachedProperties.Image}"  Stretch="None" HorizontalAlignment="Center" Margin="0" VerticalAlignment="Top"/>
                 <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                </StackPanel>
               </Grid>
              </ControlTemplate>
             </Setter.Value>
            </Setter>
        </Style>

The problem is that the binding does not work for a button:

<Button HorizontalAlignment="Center" Style="{StaticResource ButtonStyle}" VerticalAlignment="Center" Content="Button" local:AttachedProperties.Image="../Images/UserChart.png" Grid.RowSpan="2"/>

What I'm doing wrong?

+1  A: 

By the sounds of it, this is a Silverlight issue. More information at this post:

http://forums.silverlight.net/forums/p/102737/299184.aspx

Ray Booysen