wpf - How to set a viewmodel property if a listbox item selected? -
i have listbox...and bound list of items of type (class) "a". class "a" has boolean property "iscurrentviewactive". false default. when user select item in listbox....i need set "iscurrentviewactive" property of corresponding item true.
i tried below code in listbox...but not working..any appreciated.
<style x:key="listboxitemtabstyle2extended" targettype="{x:type listboxitem}" > <setter property="isselected" value="{binding path=iscurrentviewactive, mode=twoway}"/> <style.triggers> <datatrigger binding="{binding isselected, relativesource={relativesource ancestortype={x:type listboxitem}}}" value="true"> <setter property="isselected" value="{binding path=iscurrentviewactive, mode=twoway}"/> </datatrigger> </style.triggers> </style>
edit : can way or need use attached property ?
Comments
Post a Comment