Archive for June, 2011
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: action, appearance, attribute, attributes, Button, button element, change, class, code, condition, conjunction, current value, cursor, cursor moves, element, elements, flexibility, font, foreground, global resources, instances, local resources, logic, mechanism, mouse, name, page, property, property button, reference, Setter, style, text, Trigger, Triggers, TRue, value, variety, way, width
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: attribute, Background, Brushes, Button, ByVal, c implementation, class c, codebehind, Content, declaration, element elements, End, event, event handlers, implementation, MouseEnterHandler, MouseEnterMouseLeave, MouseEventArgs, MouseLeaveHandler, MyButton, name, Object, order, Partial, Public, Red, sender, set, Sub, syntax, syntax elements, UIElement, VisualBasic, void, White, XAML
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: Avalon, Button, child, child elements, codepath, creation, Direct, direction, element, event, event handlers, Forms, Handled, KeyDown, KeyUp, libraries, microsoft, NET, notification, parameter, parent elements, performance, performance advantages, Preview, PreviewKeyDown, PreviewKeyUp, question, root, Routed, routing, source element, target element, tree, Trigger, Tunneling, type, use, word preview, Works
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: amount, amount of time, Animation, attribute, change, collection, concept, Creating, data, distribution, duration, element, elements, fragment, frame animations, interpolation, interpolation methods, iterate, key frame, key frames, KeyFrame, keyframe animation, KeyTime, name, number, pace, percentage, primitive data, set, speed, SplineDoubleKeyFrame, technique, time, total, type, Uniform, value, valuesand, way, XAML
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: againif, Animation, attribute, attributes, background color, behavior, Button, ColorAnimation, continueeither, control, Controlling, declaration, DoubleAnimation, duration, elements, End, Forever, iteration, iterations, Modifying, number, period, period of time, position, repeat, RepeatBehavior, RepeatDuration, ScaleTransform, SetterTimeline, SkewTransform, speed, time, Timeline, TRue, value, width, XAML, yellow background