public class Example
{
// Button click event
public void Click(object sender, RoutedEventArgs e)
{
if (sender is Button handler)
{
switch (handler.Tag.ToString())
{
case string tag when tag.StartsWith("Example"):
// your code
break;
default:
break;
}
}
}
}