private void btn_Click(object sender, RoutedEventArgs e)
{
FrameworkElement feSource = e.Source as FrameworkElement;
switch (feSource.Name)
{
case "btn_Blue":
btn_Yellow.Content = "Yellow";
btn_Red.Content = "Red";
btn_Blue.Content = "Hello Blue!";
break;
case "btn_Yellow":
btn_Red.Content = "Red";
btn_Blue.Content = "Blue";
btn_Yellow.Content = "Hello Yellow!";
break;
case "btn_Red":
btn_Blue.Content = "Blue";
btn_Yellow.Content = "Yellow";
btn_Red.Content = "Hello Red!";
break;
}
<Border Height="80" Width="350" BorderBrush="Red" BorderThickness="4" >
<StackPanel Background="LightBlue" Orientation="Horizontal" Button.Click="btn_Click" Margin="10,10,10,10" >
<Button Background="Blue" Name="btn_Blue" Width="80" Margin="10,10,10,10">Blue</Button>
<Button Background="Red" Name="btn_Red" Width="80" Margin="10,10,10,10">Red</Button>
<Button Background="Yellow" Name="btn_Yellow" Width="80" Margin="10,10,10,10">Yellow</Button>
</StackPanel>
</Border>