wpf - What reasons could prevent explicit and implicit styles from applying? -
i have wpf test project use answering questions, somehow project got quite cluttered on time , stuff not work correctly anymore.this may not real problem since can throw away , create new 1 not quite viable solution in every case thought might interesting know can cause such behavior.
especially surprising explicit styles not apply. e.g. have style
<style x:key="enlargeimagestyle" targettype="{x:type image}"> <setter property="layouttransform"> <setter.value> <scaletransform scalex="1" scaley="{binding relativesource={relativesource self}, path=scalex}"/> </setter.value> </setter> <style.triggers> <trigger property="ismouseover" value="true"> <trigger.enteractions> <beginstoryboard> <storyboard> <doubleanimation to="2" duration="0:0:0.3" storyboard.targetproperty="layouttransform.scalex"/> </storyboard> </beginstoryboard> </trigger.enteractions> <trigger.exitactions> <beginstoryboard> <storyboard> <doubleanimation to="1" duration="0:0:0.3" storyboard.targetproperty="layouttransform.scalex"/> </storyboard> </beginstoryboard> </trigger.exitactions> </trigger> </style.triggers> </style>
which define in window.resources
, apply minimally defined image this:
<image width="80" height="48" style="{staticresource enlargeimagestyle}"> <image.source> <bitmapimage urisource="pack://application:,,,/images/img.png"/> </image.source> </image>
and won't anything, if try apply implicitly no results.
so title states, what prevent explicit , implicit styles applying?
(i not want restrict problem, reason 1 possibly encounter in wild fine)
your code looks fine , should work.make sure no other styles or animations not overriding default style. while evaluating value of dependency property, wpf dependency property system takes consideration few factors value set animation have highest precedence.go through below link more
http://msdn.microsoft.com/en-us/library/ms743230.aspx
you can make use of tools snoop debugging in run time check styles applied.
Comments
Post a Comment