I have a wpf button like this:
<Button Click="button1_Click" Height="23" Margin="0,0,5,0" Name="button1" Width="75">Initiate</Button>
And I want to pass {Binding Code} passed as parameter to the button1_click handler.
How do I go about this?
Disclaimer: really new to WPF
Simple solution:
In your handler, cast the
senderobject toButtonand access theTagproperty:A more elegant solution would be to use the Command pattern of WPF: Create a Command for the functionality you want the button to perform, bind the Command to the Button’s
Commandproperty and bind theCommandParameterto your value.