-3

Is there any way to send a parameter , with an event ?

Like this:

<CheckBox x:Name="chk1" Content="" Height="16" Width="17" Checked="MultipleSelectMeasurement(1)"/>

....

        private void MultipleSelectMeasurement(object sender, RoutedEventArgs e,int a)
        {
             System.Console.WriteLine("Check Box Nr: "+ a);
        }

Sorry I'm a newbie with this things.

user2261524
  • 415
  • 3
  • 8
  • 17
  • possible duplicate of [C# Event Argument passing](http://stackoverflow.com/questions/17256024/c-sharp-event-argument-passing) – Justin Jun 25 '13 at 14:29

2 Answers2

2

Set the Tag, cast the sender to FrameworkElement, get value from (parsed/cast) Tag.

H.B.
  • 136,471
  • 27
  • 285
  • 357
1

I can show you an example of that..

<Button Tag="passingParameter" Click="Button_Click" />

Then from code behind use..

private void Button_Click(object sender, RoutedEventArgs e)
{
     Button button1 = (Button)sender;
     NavigationService.Navigate(new System.Uri(button1.Tag.ToString()));
}

Also see..

Community
  • 1
  • 1
ridoy
  • 6,010
  • 2
  • 26
  • 60