this method worked button event passed treeview element viewmodel short syntax event not passed, problem? thanks.
<button content="search in treeview" height="34" width="100"> <i:interaction.triggers> <i:eventtrigger eventname="click"> <cal:actionmessage methodname="searchtreeview"> <cal:parameter value="{binding elementname=treeview}" /> </cal:actionmessage> </i:eventtrigger> </i:interaction.triggers> </button> <treeview x:name="treeview" itemssource="{binding treeviewsource}"/> short syntax event
<button x:name="searchtreeview" content="search in treeview" cal:message.attach="[event click] = [action searchtreeview($source.treeview)]" /> <treeview x:name="treeview" itemssource="{binding treeviewsource}"/>
you don't need specify $source.treeview, name of element, treeview enough
<button x:name="searchtreeview" content="search in treeview" cal:message.attach="[event click] = [action searchtreeview(treeview)]" /> <treeview x:name="treeview" itemssource="{binding treeviewsource}"/> that said, it's not idea pass control viewmodel. if want the selected item, should bind treeview's selecteditem property property on viewmodel , access searchtreeview method, eg
<button x:name="searchtreeview" content="search in treeview" cal:message.attach="[event click] = [action searchtreeview()]" /> <treeview x:name="treeview" itemssource="{binding treeviewsource}" selecteditem={binding myselecteditem}"/>
Comments
Post a Comment