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

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -