我得到了这些代码:
在 cs 中:
一类 get 和ImgSmall
, Name
, ImgLarge
:
List<Img> sectionList = new List<Img>
{
new Img
{
ImgSmall="Img/NG.png", Name="New Game", ImgLarge="Img/NG.png"
},
new Img
{
ImgSmall="Img/HS.png", Name="High Score", ImgLarge="Img/HS.png"
},
}
在 XAML(适用于的样式模板Images/Buttons
)中:
<Button BorderThickness="0" Click="Button_Click_1" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}">
<Image x:Name="image" Width="64" Height="64" Source="{Binding ImgSmall}" />
</Button>
Button
当我创建多个时,如何检查按下的是哪个1 Button
?我的猜测是检查传递对象的名称,但我真的不知道。
点击方式:
private void Button_Click_1(object sender, RoutedEventArgs e)
{
}