This page describes the graphics and animation types as WPF names them; UWP, WinUI, Silverlight and Avalonia have the same ideas with a few differences, listed at the end of each section. None of it is drawn by the file: the markup names the objects and the framework renders them.
Colours and brushes
A Color is written in the formats of the syntax page. A property of type Brush accepts a colour as text (it makes a SolidColorBrush), or a brush element:
| Brush | Properties |
|---|---|
SolidColorBrush | Color, Opacity, Transform, RelativeTransform |
LinearGradientBrush | StartPoint, EndPoint (0,0 to 1,1 of the filled area by default), GradientStops (content: GradientStop Color Offset), MappingMode (RelativeToBoundingBox, Absolute), SpreadMethod (Pad, Reflect, Repeat), ColorInterpolationMode |
RadialGradientBrush | the above and Center, GradientOrigin, RadiusX, RadiusY |
ImageBrush | ImageSource, Stretch, TileMode, Viewport, ViewportUnits, Viewbox, ViewboxUnits, AlignmentX, AlignmentY |
DrawingBrush, VisualBrush | Drawing or Visual, plus the tile properties of ImageBrush |
The named colours are the names of the web’s colour table (AliceBlue to YellowGreen) and Transparent, listed in Colors and Brushes. UWP and WinUI add AcrylicBrush, RevealBorderBrush and XamlCompositionBrushBase; Silverlight has no VisualBrush or DrawingBrush. Avalonia also has ConicGradientBrush.
Shapes
| Element | Properties |
|---|---|
every shape (Shape) | Fill, Stroke, StrokeThickness, StrokeDashArray (a list such as 4 2), StrokeDashOffset, StrokeDashCap, StrokeStartLineCap, StrokeEndLineCap (Flat, Square, Round, Triangle), StrokeLineJoin (Miter, Bevel, Round), StrokeMiterLimit, Stretch |
Rectangle | RadiusX, RadiusY |
Ellipse | size only |
Line | X1, Y1, X2, Y2 |
Polyline, Polygon | Points (0,0 10,5 0,10), FillRule (EvenOdd, Nonzero) |
Path | Data (a geometry, usually the string form below) |
Geometry and the path mini-language
Path.Data and other Geometry properties take either geometry elements or a string of commands. The elements: LineGeometry, RectangleGeometry (Rect, RadiusX, RadiusY), EllipseGeometry (Center, RadiusX, RadiusY), PathGeometry (Figures, FillRule) holding PathFigure (StartPoint, IsClosed, IsFilled) with segments LineSegment, PolyLineSegment, BezierSegment, PolyBezierSegment, QuadraticBezierSegment, PolyQuadraticBezierSegment, ArcSegment (Point, Size, RotationAngle, IsLargeArc, SweepDirection) and StreamGeometry, and GeometryGroup and CombinedGeometry (GeometryCombineMode: Union, Intersect, Xor, Exclude).
The string form is a sequence of commands, each a letter (upper case: absolute coordinates; lower case: relative to the current point) and its numbers, separated by commas or spaces:
| Command | Meaning | Numbers |
|---|---|---|
F0, F1 | fill rule (even-odd, non-zero); first in the string | — |
M / m | move to (starts a figure) | x,y |
L / l | line to | x,y (more pairs repeat the line) |
H / h, V / v | horizontal and vertical line | x; y |
C / c | cubic Bézier | x1,y1 x2,y2 x,y |
S / s | smooth cubic (first control point reflected) | x2,y2 x,y |
Q / q | quadratic Bézier | x1,y1 x,y |
T / t | smooth quadratic | x,y |
A / a | elliptical arc | rx,ry rotation large-arc-flag sweep-flag x,y |
Z / z | close the figure | — |
Example: Data="M 0,0 L 100,0 100,50 Q 50,80 0,50 Z". It is close to the language of the d attribute of an SVG path; the fill-rule prefix F0/F1 is XAML’s. A Geometry with a Transform is moved or scaled before it is drawn.
Transforms and effects
| Element | Properties |
|---|---|
TranslateTransform | X, Y |
ScaleTransform | ScaleX, ScaleY, CenterX, CenterY |
RotateTransform | Angle (degrees, clockwise), CenterX, CenterY |
SkewTransform | AngleX, AngleY, CenterX, CenterY |
MatrixTransform | Matrix (m11,m12,m21,m22,offsetX,offsetY) |
TransformGroup | Children, applied in order |
CompositeTransform (UWP, WinUI, Silverlight) | TranslateX, TranslateY, ScaleX, ScaleY, SkewX, SkewY, Rotation, CenterX, CenterY |
RenderTransform / LayoutTransform | after layout (does not move neighbours) and before it (does); RenderTransformOrigin is a relative point; WinUI has RenderTransform only |
BlurEffect, DropShadowEffect | Radius; Color, ShadowDepth, BlurRadius, Direction, Opacity; custom effects use ShaderEffect with a pixel shader; Avalonia has BlurEffect and DropShadowEffect; UWP and WinUI use ThemeShadow and composition effects |
Animation
An animation changes a property over time. It is described in markup as a Storyboard that contains animation objects, each naming a target and a property:
<Button Content="Hover">
<Button.Triggers>
<EventTrigger RoutedEvent="MouseEnter">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity" From="1" To="0.5" Duration="0:0:0.3"
AutoReverse="True" RepeatBehavior="2x"/>
<ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Button.Background).(SolidColorBrush.Color)">
<LinearColorKeyFrame KeyTime="0:0:0" Value="Red"/>
<EasingColorKeyFrame KeyTime="0:0:1" Value="Blue"><EasingColorKeyFrame.EasingFunction><CubicEase/></EasingColorKeyFrame.EasingFunction></EasingColorKeyFrame>
</ColorAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Button.Triggers>
</Button>
| Part | Members |
|---|---|
Storyboard (a timeline container) | attached Storyboard.TargetName (a name in the scope), Storyboard.TargetProperty (a property path), Storyboard.Target (UWP, WinUI: an object reference); SpeedRatio, FillBehavior (HoldEnd, Stop), BeginTime, AccelerationRatio, DecelerationRatio |
| every timeline | Duration (0:0:2, Automatic, Forever), BeginTime, AutoReverse, RepeatBehavior (3x, 0:0:5, Forever), FillBehavior, SpeedRatio |
| from/to/by animations | DoubleAnimation, ColorAnimation, PointAnimation, ThicknessAnimation, RectAnimation, SizeAnimation, VectorAnimation, Int16Animation, Int32Animation, Int64Animation, SingleAnimation, DecimalAnimation, ByteAnimation, Rotation3DAnimation, Point3DAnimation, Vector3DAnimation, QuaternionAnimation: From, To, By, EasingFunction, IsAdditive, IsCumulative |
| key-frame animations | XxxAnimationUsingKeyFrames with LinearXxxKeyFrame, DiscreteXxxKeyFrame, SplineXxxKeyFrame (KeySpline) and EasingXxxKeyFrame, each with KeyTime and Value; ObjectAnimationUsingKeyFrames, StringAnimationUsingKeyFrames, BooleanAnimationUsingKeyFrames take discrete frames |
| path animations | DoubleAnimationUsingPath, PointAnimationUsingPath, MatrixAnimationUsingPath: PathGeometry, Source (X, Y, Angle) |
| easing functions | BackEase (Amplitude), BounceEase (Bounces, Bounciness), CircleEase, CubicEase, ElasticEase (Oscillations, Springiness), ExponentialEase (Exponent), PowerEase (Power), QuadraticEase, QuarticEase, QuinticEase, SineEase; each has EasingMode: EaseIn, EaseOut, EaseInOut |
| trigger actions (WPF) | BeginStoryboard (Name, Storyboard, HandoffBehavior), PauseStoryboard, ResumeStoryboard, StopStoryboard, SeekStoryboard, SkipStoryboardToFill, RemoveStoryboard, SetStoryboardSpeedRatio, each naming its BeginStoryboardName |
| UWP and WinUI | storyboards live in Resources or in VisualState.Storyboard and are started by code or by a state; there are no EventTriggers except Loaded; EnableDependentAnimation="True" allows an animation that is not smooth; ThemeAnimation types (PopInThemeAnimation, FadeInThemeAnimation) and implicit Transitions (EntranceThemeTransition, RepositionThemeTransition) are added |
| Avalonia | Animation with KeyFrame Cue="50%" and Setters, in Style.Animations; Transitions (DoubleTransition Property="Opacity" Duration="0:0:0.2") |
| MAUI | animation is done in code (ViewExtensions); markup has VisualStateManager and triggers with TriggerActions |
Not described
Known, not yet covered
- Reference: 3D (
Viewport3D, models, lights, cameras),Drawingtypes (GeometryDrawing,DrawingGroup,GlyphRunDrawing), media timelines andMediaTimelineare named, not described. - Reference: the composition-layer animations of UWP and WinUI (implicit animations,
Compositor) are code, not markup, and are not described.
Unknown
- Reference: whether the colour names are the same set in every framework was not tested.