Get The Name
private void MyMethod_Click(object sender, RoutedEventArgs e)
{
Control CallingControl = (Control)sender;
String CallingObjectName = CallingControl.Name;
}
Get The Actual Control
private void chkOp_Click(object sender, RoutedEventArgs e)
{
Control CallingControl = (Control)sender;
CheckBox CallingCheckbox = (CheckBox)CallingControl;
if ((bool)CallingCheckbox.IsChecked
private void chkOp_Click(object sender, RoutedEventArgs e)
{
CheckBox CallingCheckbox = (CheckBox)CallingControl;
if ((bool)CallingCheckbox.IsChecked
For Specific Object Types
private static Windows.Media.Playback.MediaPlayer BackgroundMediaPlayer1 = new Windows.Media.Playback.MediaPlayer();
private static Windows.Media.Playback.MediaPlayer BackgroundMediaPlayer2 = new Windows.Media.Playback.MediaPlayer();
private static void MediaPlayer_MediaEnded(Windows.Media.Playback.MediaPlayer sender, object args)
{
if (sender == BackgroundMediaPlayer1)
{
}
if (sender == BackgroundMediaPlayer2)
{
}
}
Feel free to comment if you can add help to this page or point out issues and solutions you have found. I do not provide support on this site, if you need help with a problem head over to stack overflow.