What is Ammy?

Ammy is a JSON-like UI language for developing XAML based applications. It has a concise, well structured syntax that is both easy to read and write. During compilation Ammy files are translated to XAML and compiled as normal XAML controls.

The “Hello, World!” example in Ammy looks something like this:

Window "MyApp.MainWindow" { TextBlock { "Hello, World!" } }

Ammy’s MSBuild task will generate a XAML file with “.g.xaml” extension alongside the original one with this content:

< Window x:Class = " MyApp.MainWindow " xmlns = " http://schemas.microsoft.com/winfx/2006/xaml/presentation " xmlns:x = " http://schemas.microsoft.com/winfx/2006/xaml " Ammy.Register = " /MyApp;component/MainWindow.g.xaml " > < TextBlock > Hello, World! </ TextBlock > </ Window >

Notice the Register attached property, it will be explained shortly.

Why should I use Ammy?

XAML is a great language, well thought-out and powerful. Nevertheless, it can be frustrating to write lots of XAML in order to achieve a smallest change. Styles are not composable, templates are big and complex. This means poor code reuse and long XAML files. Ammy offers mixins to solve this issue. Mixin is like a function, that is defined once and used as much as needed. For example:

mixin TwoRows ( height1 , height2 ) for Grid { RowDefinitions : [ RowDefinition { Height : $height1 } RowDefinition { Height : $height2 } ] } Grid { #TwoRows ( 35 , "*" ) }

As you can see, mixins can take parameters and output content, either properties, nodes or both. This is a really powerful feature that can greatly improve code reuse and overall application architecture.

Ammy also has variables, used like this:

$normalFontColor= "#3f3f3f" TextBlock { Foreground : $normalFontColor }

Once defined globally, variables can be used anywhere in a program. By the way, if a variable is defined inside a node and not in a global scope, then it will only be seen inside that node. Same can be said about mixins.

No recompilation needed!

Perhaps the most important Ammy’s feature is an ability to develop UI without recompilation. In fact, Register property we saw earlier is used to register your page to become updatable.

Run your application and while it is running, make modifications to user interface code, save file and see application updated! All of the state is preserved, and only parts of the UI that were actually changed in code are updated in the app.

Imagine, you are developing some complex settings page. From you main application you click “Settings” button, then you click some tab header to switch to your currently developed control. Normally you would have to repeat these steps every time you changed something and restarted your application, but with Ammy you just hit save, and observe updated UI.

Another, perhaps better example would be a twitter application. While designing a tweet look, usually you don’t want to reload whole backend just to see if increased font size looks better or not. Live user interface development is a great way to diminish development time. Things that previously took hours now take minutes.

Demonstation

This video shows development of a simple data entry application using Ammy framework. Note how structure and presentation are separated with the help of mixins.

How to install?

To use Ammy you need Ammy Visual Studio Extension and Ammy NuGet package.

For more information, please refer to www.ammyui.com/documentation/quickstart

Project website: www.ammyui.com