c# - DataBinding with datatriggers XAML with Boolean Local Variable -
i having trouble getting tabitem flash when value newcall true. think have xaml correct not sure how bind behind in code. when variable new call set true tabitem flash.
<tabitem.style> <style targettype="{x:type tabitem}" basedon="{staticresource metrotabitem}"> <style.resources> <storyboard x:key="flashanimation" > <doubleanimation storyboard.targetproperty="opacity" from="1" to="0" autoreverse="true" duration="0:0:0.5" repeatbehavior="forever" /> </storyboard> </style.resources> <style.triggers> <datatrigger binding="{binding newcall}" value="true"> <datatrigger.enteractions> <beginstoryboard name="flash" storyboard="{staticresource flashanimation}" /> </datatrigger.enteractions> </datatrigger> </style.triggers> </style> </tabitem.style>
your viewmodel has implement inotifypropertychanged
. in viewmodel add following code:
private bool _newcall; public bool newcall { { return _newcall; } set { _newcall = value; if (propertychanged != null) { propertychanged(this, new propertychangedeventargs("newcall")); } } }
and change binding="{binding newcall}
binding="{binding newcall, updatesourcetrigger=propertychanged}"
then, tabitem start flashing newcall set true
Comments
Post a Comment