mvvm - Problem Binding Commands to TreeViewItem using MVVMLight -
i'm trying use mvvmlight bind treeviewitem selected event command.
the treeviewitem's defined in hierarchicaldatatemplate cannot add interaction.triggers (as shown below)
<hierarchicaldatatemplate x:key="treeviewitemtemplate" itemssource="{binding childreportviewmodels}"> <i:interaction.triggers> <i:eventtrigger eventname="selected"> <mvvmlight_command:eventtocommand command="{binding loadreportcommand, mode=oneway}" /> </i:eventtrigger> </i:interaction.triggers> </hierarchicaldatatemplate>
how else can add eventtrigger each treeviewitem?
thanks.
i forgot question.
for future ref, here's solution used...
instead of trying bind eventtocommand selected event of treeview, bound mouseleftbuttonupevent of textblock declared in hierarchicaldatatemplate treeviewitems.
<hierarchicaldatatemplate x:key="treeviewitemtemplate" itemssource="{binding childreportviewmodels}" itemcontainerstyle="{staticresource treeviewitemcontainerstyle}"> <stackpanel orientation="horizontal"> <textblock text="{binding name}"> <i:interaction.triggers> <i:eventtrigger eventname="mouseleftbuttonup"> <gs_cmd:eventtocommand command="{binding loadpublicationcommand, mode=oneway}" commandparameter="{binding}" /> </i:eventtrigger> </i:interaction.triggers> </textblock> </stackpanel> </hierarchicaldatatemplate>
Comments
Post a Comment