Use the mvvm architecture component provided by expression blend 4 SDK

Source: Internet
Author: User

1. To use the mvvm framework provided by blend in XAML, you need to add the following namespace for reference:

Xmlns: I = "CLR-namespace: system. Windows. interactivity; Assembly = system. Windows. Interactivity"
Xmlns: Ei = "CLR-namespace: Microsoft. expression. interactivity. Core; Assembly = Microsoft. expression. Interactions"

Or
Xmlns: I = "http://schemas.microsoft.com/expression/2010/interactivity"
Xmlns: Ei = "http://schemas.microsoft.com/expression/2010/interactions"

2. Do not write C # code to implement a opacity gradient animation during image loading:

<Image X: Name = "myimage" Source = "http://www.silverlightinaction.com/man.png">
<! -- Image trigger -->

<Image. triggers>

<! -- Image loading event trigger -->
<Eventtrigger routedevent = "image. Loaded">
<! -- Start playing a story animation -->

<Beginstoryboard>
<Storyboard X: Name = "mystoryboard">
<Doubleanimation duration = "0: 0"
Storyboard. targetname = "myimage"
Storyboard. targetproperty = "opacity"
From = "0" to = "1"/>
</Storyboard>
</Beginstoryboard>
</Eventtrigger>
</Image. triggers>
</Image>

3. The view layer calls the method in the viewmodel layer:

Xmlns: I = "http://schemas.microsoft.com/expression/2010/interactivity"
Xmlns: Ei = "http://schemas.microsoft.com/expression/2010/interactions"

<I: interaction. triggers>
<I: eventtrigger eventname = "mouseleftbuttondown">
<! -- Bind targetobject to the corresponding element that holds the event -->
<EI: callmethodaction methodname = "close" targetobject = "{binding}"/>
</I: eventtrigger>
</I: interaction. triggers>

4.

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.