c# - How to use Composite command in mvvm -
intro i'm working wpf mvvm-light application
goal
i have invoke 2 commands same event, possible using mvvm.?
xaml this
<i:interaction.triggers> <i:eventtrigger eventname="loaded"> <command:eventtocommand command="{binding command1}" passeventargstocommand="false" /> <command:eventtocommand command="{binding command2}" passeventargstocommand="false" /> </i:eventtrigger> </i:interaction.triggers>
problem
when hooking 2 commands 1 of them invoked while triggering event.
q1 how invoke 2 commands in event?
i have heard composite commands in prism
for example, compositecommand
class used in stock trader reference implementation (stock trader ri) in order implement submitallorders
command represented submit button in buy/sell view. when user clicks submit button, each submitcommand
defined individual buy/sell transactions executed.
.
q2 there in mvvm ?
try using 2 event triggers:
<i:interaction.triggers> <i:eventtrigger eventname="loaded"> <command:eventtocommand command="{binding command1}" passeventargstocommand="false" /> </i:eventtrigger> <i:eventtrigger eventname="loaded"> <command:eventtocommand command="{binding command2}" passeventargstocommand="false" /> </i:eventtrigger> </i:interaction.triggers>
Comments
Post a Comment