我有一个包含10个按钮的列表,当我选择该按钮时,我想在其中应用特定的样式,我确实喜欢这样:
private bool button1WasClicked = false;
private bool button2WasClicked = false;
private bool button3WasClicked = false;
.....
private void button1_Click(object sender, EventArgs e)
{
button1WasClicked = true;
}
private void button2_Click(object sender, EventArgs e)
{
button2WasClicked = true;
}
private void Page_Loaded(object sender, RoutedEventArgs e)
{
if (button1WasClicked)
{
apply the style on Button1
button1WasClicked = false;
}
if (button2WasClicked)
{
apply the style on Button2
button2WasClicked = false;
}
...... //complete the list of other buttons
}
我的问题是,我可以使用任何其他方法将样式应用于我的10个按钮的选定按钮而不是其他按钮
我希望有人可以帮助我.. 感谢