WPF calling commands via events -
Is it possible to call commands in WPF through an event?
I have a Save button when a pressed call is called a command, then it is pressed when you edit the text box, it also assigns the object as a command parameter
& lt; Button content = "save" command = "{binding data content} .SaveQueueTimeCommand, RelativeSource = {relative saras FindAncestor, ancestor type = {x: type objects contact}}}" commandpalmter = "{binding}" />
What I would ideally like to do is call this command and pass the object as a parameter when the text box loses focus, by pressing the button, something like this:
& lt; Button Lost Focus = "{Binding Saving Quali Time Commands}" />
And still somehow pass the object as a parameter. Thanks for the itemprop
The easiest way to do this is using interaction triggers.
& lt; Grid xmlns: i = "http://schemas.microsoft.com/expression/ 2010/Interactivity" & gt; & Lt; I: Interaction.Triggers & gt; & Lt; I: EventTrigger EventName = "SomeEvent" & gt; & Lt; I: InvokeCommandAction command = "{Binding Path = some Commands, Mode = Options}" /> & Lt; / I: EventTrigger & gt; & Lt; / I: Interaction.Triggers & gt; & Lt; / Grid & gt;
I've added it for future generations.
Comments
Post a Comment