c# - React on state change in content (Windows Phone) -



c# - React on state change in content (Windows Phone) -

is possible content of command react visual state alter of parent?

in next illustration i'd textblock's foreground alter red, when parent command active. code doesn't work:

<local:expandkeybutton x:name="xpand" height="30"> <textblock x:name="tb"> test <visualstatemanager.visualstategroups> <visualstategroup x:name="general"> <visualstate x:name="idle" /> <visualstate x:name="active"> <storyboard> <objectanimationusingkeyframes storyboard.targetname="tb" storyboard.targetproperty="foreground"> <discreteobjectkeyframe keytime="0" value="red" /> </objectanimationusingkeyframes> </storyboard> </visualstate> </visualstategroup> </visualstatemanager.visualstategroups> </textblock> </local:expandkeybutton>

no -- visual states internal control, in sense ui elements outside owning controltemplate cannot (directly) participate in visual state changes. see few possibilities in scenario:

if "tb" textblock general feature of "expandkeybutton", move within controltemplate, allow participate in visual state changes. or, more loosely-coupled approach, add together either property or event "expandkeybutton" control, allow textblock bind state. example, add together "isactive" dependency property, set appropriately within controltemplate's visualstatemanager -- , textblock utilize binding foreground="{binding elementname=xpand,path=isactive,converter={staticresource activetocolorconverter}}" create reddish when command active.

c# wpf xaml windows-phone windows-phone-8.1

Comments

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

Is there a way to convert an HTML page styled with Bootstrap CSS into email-compatible html? -