WPF : Geometry mini-language

Interesting!

Lammentations of a one programmer

It is really cool feature of WPF. Instead of typing lots of tags to describe visual elements in your GUI, you can just fill out the property Data of path element with special textual value. I like the way it is designed, because it gives somewhat old-school crypted form. The benefit is that it is short and very straightforward. Take a look!

Consider the following XAML code:

<Path Stroke=”Black”>
    <Path.Data>
        <PathGeometry>
            <PathFigure IsClosed=”true” StartPoint=”10,100″>
                <LineSegment Point=”100,100″ />
                <LineSegment Point=”100,50″ />
            </PathFigure>
        </PathGeometry>
    </Path.Data>
</Data>

And now, take a look on condensed “mini language” form:

<Path Stroke=”Blue” Data=”M 10 100 L 100 100 L 100 50 Z” />

Pretty cool, ha?

These are the commands for the Geometry Mini-Language:

F value – Sets the Geometry.FillRule property. Use  for EvenOdd, or 1 for NonZero. This command must appear at the beginning of the string (if you…

Ver la entrada original 277 palabras más

Responder

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión / Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión / Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión / Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión / Cambiar )

Conectando a %s