Silverlight for Windows Phone has disabled most eventtrigger

Source: Internet
Author: User

When I started eventtrigger this morning, I found that except loaded, all other uielement. tapevents were unavailable.

After a long time, I checked msdn and found that:

In XAML you specify this as a string. in code, pass the identifier (A routedevent value.) The only supported value in Silverlight is loaded/frameworkelement. loadedevent.

Http://technet.microsoft.com/en-us/library/system.windows.eventtrigger.routedevent (V = vs.95). aspx

 

 

Eventtrigger and the object. triggers property element usage on elements are supported by Silverlight, but using this technique is discouraged for current applications. eventtrigger can only support a triggering action for the loaded event (you name the event in the eventtrigger. routedevent property .) this makes an eventtrigger unsuitable for most run-time interactions. instead of using eventtrigger and the triggers property, consider one of the following two alternatives:

 

  • For animating properties on objects that are not controls, place the storyboard in the general resources for a page or application. then assign an event handler on the element where you wowould have placed "triggers ". the event handler, when responding to the relevant event, shocould retrieve the storyboard from the resource dictionary. you then call begin on the retrieved storyboard.

  • For animating properties on objects that are controls (derive from control), use the visualstatemanager technique, and run the appropriate animations based on state of or inputs to the control by calling gotostate.

Http://technet.microsoft.com/en-us/library/system.windows.eventtrigger (V = vs.95). aspx

 

Tragedy!

We recommend that you use visualstate.

Goodbye,

<Stackpanel margin = "0, 1,-5, 0" orientation = "horizontal">
<Checkbox content = "zhangsan" fontsize = "26" foreground = "white" X: Name = "Chk"/>
<Textblock text = "13512312312" verticalalignment = "center" fontsize = "18" foreground = "gray" margin = ","/>
<Stackpanel. triggers>
<Eventtrigger routedevent = "stackpanel. Loaded">
<Beginstoryboard>
<Storyboard>
<Doubleanimation from = "26" to = "30" Duration = "00:00:03" storyboard. targetname = "Chk" storyboard. targetproperty = "fontsize"/>
</Storyboard>
</Beginstoryboard>
</Eventtrigger>
</Stackpanel. triggers>
</Stackpanel>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.