1
我嘗試點擊相同的按鈕時,按鈕的兩幅圖像之間進行切換時 我的XAML代碼是上的按鈕改變圖像點擊XAML
<Button x:Name="BidderOne"
Click="BidderOne_Click" Height="5"
Grid.Row="2"
BorderBrush="#FFE7E3E3"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Margin="350,0,0,280"
>
<Button.Template>
<ControlTemplate>
<Image x:Name="BidderOneImage"
Source="/Assets/Star.png"
Width="50"/>
</ControlTemplate>
</Button.Template>
</Button>
林不知道,在我的課寫什麼,但我發現,沿着這
private void BidderOne_Click(object sender, RoutedEventArgs e)
{
var selectedBidder = sender as Button;
// Button btn = new Button();
// btn = BidderOne;
ControlTemplate dt = BidderOne.Template;
Image btnImage = (Image)dt.TargetType = ;
var img = (Image)(selectedBidder.ContentTemplateRoot as StackPanel).Children[0];
var uri = new Uri("/Assetes/ClubsLogo.png", UriKind.Relative);
// var sri = Windows.UI.Xaml.Application.("Assetes/ClubsLogo.png", UriKind.Relative);
imgOn.UriSource=uri;
img.Source = imgOn;
}
即時得到一個語法錯誤。 「ControlTemplate不包含FindName的定義,也沒有擴展方法 – user2800591
Ups ...我沒有看到windows-phone-8.1標記,很抱歉... – Nacho
有沒有辦法解決它? – user2800591