mvvm - DataTriggerBehavior Binding to Property on ViewModel -


i'm trying bind datatriggerbehavior property on viewmodel, doesn't ever fire.

i've used datatriggerbehaviors bound various properties of controls no trouble can't vm binding work.

datacontext set vm. can see binding value in debug nothing triggers. i've tested invokecommandaction changing datatriggerbehavior eventtriggerbehavior works fine.

                <appbarbutton icon="library">                     <i:interaction.behaviors>                         <core:datatriggerbehavior binding="{binding helpphase}" comparisoncondition="equal" value="add" >                             <core:invokecommandaction command="{binding datacontext.storeratecommand, elementname=layoutroot}"/>                         </core:datatriggerbehavior>                     </i:interaction.behaviors>                 </appbarbutton> 

in vm (inherits vmbase implements ipcn)

private mhelpphase string     public property helpphase() string                     return settings.helpphase         end         set(value string)             setproperty(settings.helpphase, value)         end set     end property 

the eventtriggerbehavior listens specific event on source , executes action when event fired. different datatriggerbehavior.

the datatriggerbehavior performs action when data behaviors bound meets specified condition. in question, when bound data of helpphase's value change "add", behavior triggers action fire command.

you should able check if have bind helpphase datatriggerbehavior , set "add" helpphase. can bind helpphase text property of textblock if textblock show "add".

there official datatriggerbehavior sample, please refer xamlbehaviors sample.


Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -