我可以使用<Style.Triggers>
,我收到消息"在类型"style"中找不到可附加属性"triggers"?我需要使用它,用于更改背景图像图片。有人能帮我吗?
<Button Content ="A" Name="btmeunu" Width="77" HorizontalAlignment="Left"
BorderBrush="{x:Null}" Height="75" Margin="-8,-16,0,-6">
</Button>
//Convertor
public class BackgroundImageConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
bool isClicked = (bool)value;
if(isClicked)
{
return new ImageBrush([[image1.png as bitmap]]//Change accordingly)
}
return new ImageBrush([[image2.png as bitmap]]//Change accordingly)
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return value;
}
}
//XAML
Background="{Binding RelativeSource={RelativeSource Self}, Path=IsPressed,Converter={StaticResource BackgroundImageConverter}}"
它是windows 8 metro风格的应用程序吗??Windows 8 Metro风格的应用程序不支持触发器。