wpf - Firing a Command within EventTrigger of a style? -
as know can't bind event directly command without behaviour:
<datagrid> <i:interaction.triggers> <i:eventtrigger eventname="previewmousedoubleclick"> <i:invokecommandaction command="{binding tradeentrycommand"} /> </i:eventtrigger> </i:interaction.triggers> </datagrid>
this works fine, have refactor double clicking datagrid double clicking cell. (i don't care cell clicked)
i hoping define behviour inside cell style this:
<style x:key="defaultcellstylebase" targettype="{x:type datagridcell}"> <setter property="template"> <setter.value> <controltemplate targettype="{x:type datagridcell}"> <controltemplate.triggers> <eventtrigger routedevent="previewmousedoubleclick"> ????????? </eventtrigger> </controltemplate.triggers> </controltemplate> </setter.value> </setter> <!-- ... --> </style>
but how bring in behaviour above fire command?
highly appreciated,
since retemplating datagridcell, add triggers root element in control template. like:
<controltemplate targettype="{x:type datagridcell}"> <grid x:name="root" background="transparent"> <i:interaction.triggers> <i:eventtrigger eventname="previewmousedoubleclick"> <i:invokecommandaction command="{binding tradeentrycommand}" /> </i:eventtrigger> </i:interaction.triggers> </grid> </controltemplate>
Comments
Post a Comment