Introduction
i will explain The Geometry Mini-Language.
Description
he geometries you’ve seen so far have been relatively concise, with only a few points. More complex geometries are conceptually the same but can easily require hundreds of segments. Defining each line, arc, and curve in a complex path is extremely verbose and unnecessary—after all, it’s likely that complex paths will be generated by a design tool rather than written by hand, so the clarity of the markup isn’t all that important.
With this in mind, the creators of Silverlight added a more concise alternate syntax for defining geometries that allows you to represent detailed figures with much smaller amounts of markup.
This syntax is often described as the geometry mini-language (and sometimes the path mini-language due to its application with the Path element).
To understand the mini-language, you need to realize that it is essentially a long
string holding a series of commands. These commands are read by a type converter that then creates the corresponding geometry. Each command is a single letter and is optionally followed by a few bits of numeric information (such as x and y coordinates) separated by spaces. Each command is also separated from the previous command with a space. For example, a bit earlier you created a basic triangle using a closed
Example
XAML
CS
i will explain The Geometry Mini-Language.
Description
he geometries you’ve seen so far have been relatively concise, with only a few points. More complex geometries are conceptually the same but can easily require hundreds of segments. Defining each line, arc, and curve in a complex path is extremely verbose and unnecessary—after all, it’s likely that complex paths will be generated by a design tool rather than written by hand, so the clarity of the markup isn’t all that important.
With this in mind, the creators of Silverlight added a more concise alternate syntax for defining geometries that allows you to represent detailed figures with much smaller amounts of markup.
This syntax is often described as the geometry mini-language (and sometimes the path mini-language due to its application with the Path element).
To understand the mini-language, you need to realize that it is essentially a long
string holding a series of commands. These commands are read by a type converter that then creates the corresponding geometry. Each command is a single letter and is optionally followed by a few bits of numeric information (such as x and y coordinates) separated by spaces. Each command is also separated from the previous command with a space. For example, a bit earlier you created a basic triangle using a closed
Example
XAML
<usercontrol
x:class="VC40.Page" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:ignorable="d" d:designheight="300" d:designwidth="400"> <Grid x:Name="LayoutRoot" Background="White"> <Path Stroke="Blue"> <Path.Data> <PathGeometry> <PathFigure IsClosed="True" StartPoint="10,100"> <LineSegment Point="100,100" /> <LineSegment Point="100,50" /> </PathFigure> </PathGeometry> </Path.Data> </Path> </Grid>
</usercontrol>
|
CS
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
namespace VC40
{ public partial class Page : UserControl { public Page() { InitializeComponent(); } } } |
0 comments :
Post a Comment