c# - MouseWheel EventToCommand for StackPanel -
i have stackpanel listview inside. want able scroll inside window, change selecteditem.
to clarify; want change viewmodels selecteditem when mousewheel scrolled.
i cannot find way bind command event through eventtocommand
i thought pulled off doing
<stackpanel> <i:eventtrigger eventname="mousewheel"> <cmd:eventtocommand passeventargstocommand="true" command="{binding mousescrollcommand}"> </cmd:eventtocommand > </i:eventtrigger> <listview/> </stackpanel>
but gets me error stating eventtrigger can assinged uielement.
then tried inside listview - didn't work.
how can bind event (with args) scrollwheel event?
i think you're there, need wrap eventtrigger in system.windows.interactivity interaction class:
<stackpanel> <i:interaction.triggers> <i:eventtrigger eventname="mousewheel"> <cmd:eventtocommand passeventargstocommand="true" command="{binding mousescrollcommand}"> </cmd:eventtocommand > </i:eventtrigger> </i:interaction.triggers> <listview/> </stackpanel>
you should find raise event, , call command.
the interaction class handles events on associated object, , propagates them through eventtriggers.
Comments
Post a Comment