Silverlight: VisualState Animation Being Overridden Somehow -
i've got rather complicated custom control boggle mind if showed of code. ;) in general it's panel displaying multiple controls. can think of custom list box. (please don't tell me use listbox, i've been there , doesn't meet needs completely).
so, set animations in visualstatemanager. here's happens:
- when hover on 1 of child controls, expect mouseover state fire. does.
- when select 1 of child controls expect selected state fire , does.
- when select different child control, selected state fires well
- when go first child control selected, , select it, selected state shown fire (by debug statements in code) mouseover animation displayed.
is there issue animations able overridden somehow or problem between mouseover , selected states i'm not aware of?
here's vsm markup:
<visualstatemanager.visualstategroups> <visualstategroup x:name="commonstates"> <visualstate x:name="normal"> <storyboard> <coloranimationusingkeyframes begintime="0" duration="00:00:00.150000" storyboard.targetname="backdrop" storyboard.targetproperty="(border.background).(solidcolorbrush.color)"> <splinecolorkeyframe keytime="0" value="darkgray"/> </coloranimationusingkeyframes> </storyboard> </visualstate> <visualstate x:name="mouseover"> <storyboard> <coloranimationusingkeyframes begintime="0" duration="00:00:00.150000" storyboard.targetname="backdrop" storyboard.targetproperty="(border.background).(solidcolorbrush.color)"> <splinecolorkeyframe keytime="0" value="yellow"/> </coloranimationusingkeyframes> </storyboard> </visualstate> </visualstategroup> <visualstategroup x:name="selectedstates"> <visualstate x:name="unselected"> <storyboard> <coloranimationusingkeyframes begintime="0" duration="1" storyboard.targetname="backdrop" storyboard.targetproperty="(border.background).(solidcolorbrush.color)"> <splinecolorkeyframe keytime="0" value="purple"/> </coloranimationusingkeyframes> </storyboard> </visualstate> <visualstate x:name="selected"> <storyboard> <coloranimationusingkeyframes begintime="0" duration="1" storyboard.targetname="backdrop" storyboard.targetproperty="(border.background).(solidcolorbrush.color)"> <splinecolorkeyframe keytime="0" value="green"/> </coloranimationusingkeyframes> </storyboard> </visualstate> </visualstategroup> </visualstatemanager.visualstategroups>
and here's gotostate() logic:
private void gotostate(bool usetransitions) { testingvariables("inside gotostate");
if (_isselected) { system.diagnostics.debug.writeline(_thumbnail.shortfilename + " firing selected vsm"); visualstatemanager.gotostate(this, "selected", usetransitions); } else if (_wasselected) { _wasselected = false; system.diagnostics.debug.writeline(_thumbnail.shortfilename + " firing unselected"); visualstatemanager.gotostate(this, "unselected", usetransitions); } else if (_ismouseover) { system.diagnostics.debug.writeline(_thumbnail.shortfilename + " firing mouseover vsm"); visualstatemanager.gotostate(this, "mouseover", usetransitions); } else { system.diagnostics.debug.writeline(_thumbnail.shortfilename + " firing normal vsm"); visualstatemanager.gotostate(this, "normal", usetransitions); }
}
so, can see visualstatemanger.gotostate() method fired , call testingvariables() method use write out conditional flags i'm using determine visual state fire.
thanks in advance.
see answer question: custom styled listbox - how can keep style selected item?
Comments
Post a Comment