animation - wpf visual state manager with condition -
i tring style itemcontainerstyle of listbox changing mouseover , selected state .
with that
<visualstate x:name="mouseover"> <storyboard> <coloranimationusingkeyframes storyboard.targetproperty="(panel.background).(solidcolorbrush.color)" storyboard.targetname="border"> <easingcolorkeyframe keytime="0" value="#48ff5643"/> </coloranimationusingkeyframes> </storyboard> </visualstate> <visualstategroup x:name="selectionstates"> <visualstate x:name="unselected"/> <visualstate x:name="selected"> <storyboard> <coloranimationusingkeyframes storyboard.targetproperty="(panel.background).(solidcolorbrush.color)" storyboard.targetname="border"> <easingcolorkeyframe keytime="0" value="#ffff5643"/> </coloranimationusingkeyframes> </storyboard> </visualstate> <visualstate x:name="selectedunfocused"/> </visualstategroup> come in code here
the problem if have item selected , mouse on it's state alter mouseoverstate , want avoid that
i have tried controltemplate multitriggers like
<multitrigger.conditions> <condition property="isselected" value="false" /> <condition property="ismouseover" value="false" /> </multitrigger.conditions>
but did not work , , there not ismouseleave property
hopefully explain problem , help welcome
thanks , day !
it's much easier changing listboxitem.background
property using trigger
, systemcolors
. seek instead:
<listbox itemssource="{binding days}"> <listbox.itemcontainerstyle> <style targettype="{x:type listboxitem}"> <style.resources> <solidcolorbrush x:key="{x:static systemcolors.highlightbrushkey}" color="#ffff5643" /> <solidcolorbrush x:key="{x:static systemcolors.controlbrushkey}" color="#ffff5643" /> <solidcolorbrush x:key="{x:static systemcolors.highlighttextbrushkey}" color="black" /> </style.resources> <style.triggers> <trigger property="ismouseover" value="true"> <setter property="background" value="#48ff5643" /> </trigger> </style.triggers> </style> </listbox.itemcontainerstyle> </listbox>
i have feeling these systemcolors
might not work on either windows 8 or .net 4.5, .net 4 , windows 7. allow me know if wanted.
update >>>
the problem mouseleave, there no such property on eventtriggers
perhaps should investigate trigger
class further?:
<trigger property="ismouseover" value="true"> <trigger.enteractions> <!--performed mouseenter event--> </trigger.enteractions> <trigger.exitactions> <!--performed mouseleave event--> </trigger.exitactions> </trigger>
wpf animation expression-blend
No comments:
Post a Comment