XAML Review
www.shaxam.com

Archive for June, 2011

Triggers in XAML

Posted in Software
shaxam.com

Triggers allow you to change attributes of an element when a specific action occurs. For example, you can change the font color of text when the mouse hovers over it, or change the width of a button once it has been clicked. Triggers can act on single instances of an element, or affect an entire class of elements.

Triggers are conditional. They are essentially a way to implement standard if…then logic without writing external code. In other words, a trigger evaluates an attribute and if the current value of that attribute matches the value specified by the trigger, then the style is applied. If the cursor moves over a Button, then change the background to green.
Read the rest of this entry »

Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

XAML Events Element

Posted in Software
shaxam.com

Elements deriving from UIElement inherit a set of common events. Events are used in XAML to specify the codebehind handler that will be executed when the specified event is raised. All events can be assigned a codebehind handler using the following syntax:

Elements specifying a codebehind handler must declare the Name attribute in order to be referenced in the codebehind class.
Read the rest of this entry »

Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

XAML Routed Event Strategies

Posted in Software
shaxam.com

There are three types of routed event strategies in Avalon: bubble, direct, and tunnel:

Bubble
A bottom-up routing strategy. The target element is first notified, then its parent, then its parent, and so on. If the event is marked Handled, then no other event handlers will be invoked. Microsoft suggests marking an event as Handled as soon as you know that there are no further elements along the route because there are performance advantages to keeping the codepath as short as possible.
Read the rest of this entry »

Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Animation based on KeyFrames

shaxam.com

KeyFrame animations are another method for animating elements in XAML. They differ from non-key animations in that they use a number of key frames (values) as the destination rather than allowing the system to iterate through the values. KeyFrame animations allow you to control the specific valuesand the interpolation methods used to arrive at themacross a number of key frames that make up the animation.

KeyFrame animations use different classes than non-key frame animations, but they are easily recognizable because each one uses the term “KeyFrame” in its name. As with non-key animations, there are KeyFrame animations for almost every primitive data type and some XAML elements.
Read the rest of this entry »

Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Animation Controlling

shaxam.com

Animation elements inherit several attributes from Timeline that control the speed and behavior of the animation. One of the more useful attributes is SpeedRatio, which controls the speed at which the animation moves. The attribute AutoReverse is also noteworthy. AutoReverse controls the behavior of the Timeline when it reaches the end of its Duration. Setting this value to TRue will cause the animation to reverse itself when it reaches the end of its iteration. Setting it to false will cause the animation to begin againif RepeatBehavior indicates that it should continueeither for a specified number of iterations through the animation, for a specified period of time, or forever.

RepeatBehavior is now declared as 2x and AutoReverse has been added and set to true. This animation will repeat twice, reversing itself each time. Although the animation declaration makes it appear that the Button will have a yellow background at the end of the animation, the background will actually be blue because we have set AutoReverse to true.
Read the rest of this entry »

Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,