我有这种风格:
<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>
问题是绑定对按钮不起作用:
<Button HorizontalAlignment="Center" Style="{StaticResource ButtonStyle}" VerticalAlignment="Center" Content="Button" local:AttachedProperties.Image="../Images/UserChart.png" Grid.RowSpan="2"/>
我做错了什么?
答案 0 :(得分:1)
听起来,这是一个Silverlight问题。有关此帖子的更多信息: