1
我在我的應用程序創建圖像的按鈕:按鍵採用圖像藍色背景
<Button x:Name="favoriteButton" HorizontalAlignment="Left" VerticalAlignment="Top" Height="72" Width="99" Click="DidPressAddToFavorites" BorderBrush="{x:Null}" Foreground="{x:Null}">
<Button.Background>
<ImageBrush ImageSource="/Images/[email protected]" Stretch="Uniform"/>
</Button.Background>
</Button>
而且我注意到,當用戶按下按鈕按鈕變成藍色,當我鬆開按鈕,我再次看到它。任何想法如何解決它?
編輯:
這是處理方法:
private void DidPressAddToFavorites(object sender, RoutedEventArgs e)
{
if (favoriteRep.ExistInFavorites(currentItem) == true)
{
this.SetButtonWithImage(favoriteButton, "/Images/[email protected]");
favoriteRep.RemoveFromFavorites(currentItem);
}
else
{
this.SetButtonWithImage(favoriteButton, "/Images/[email protected]");
favoriteRep.AddToFavorites(currentItem);
}
}
編輯模板,你能告訴我們更多,或者顯示在DidPressAddToFavorites上執行的代碼嗎? – 2013-02-13 09:17:11
我加了這個方法, – MTA 2013-02-13 09:20:11