I’m trying to pass parameters to a function that is used in a RoutedEventHandler
Button start = new Button();
start.Click += new RoutedEventHandler(playSelectedAlarm_Click);
private void playSelectedAlarm_Click(object sender, EventArgs e)
{
NavigationService.Navigate(new Uri("/AlarmPicker.xaml", UriKind.Relative));
}
how do I do this? Or is there a better way?
You could add your parameters into the Button’s Tag property. Then, extract them in your event handler:
The
Tagproperty expects anobjecttype, so you can input an array of parameters, collection, string etc..