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…

View original post 277 more words

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s