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.