Add XAML examples and complete description.

This commit is contained in:
José Manuel Nieto 2015-06-13 13:28:51 +02:00
Родитель 53447b8db0
Коммит fe7aece9ba
1 изменённых файлов: 43 добавлений и 3 удалений

Просмотреть файл

@ -1,7 +1,7 @@
# OmniXAML
Portable XAML Reader.
The Cross-platform XAML Framework.
I know you need it, I know you want it. XAML!
I know you need it, I know you want it. I know you XAML!
```csharp
foreach (var thing in life)
@ -10,6 +10,46 @@ foreach (var thing in life)
}
```
For the moment, there is only a Markup Extension parser.
OmniXAML is a library that allows you interpret XAML with ease. You can read XAML and get the object it represents, like a Window in WPF, a document, a diagram or whatever object you can describe.
In its current state it's able to interpret more or less complex XAML without problems.
It already can deal with the some features that make XAML the coolest descriptive XML-based language, like:
- XAML namespaces
- Prefix definitions
- Content Properties.
- Markup Extensions (i.e. Bindings, x:Type, StaticResource…)
- Deferred reading (DataTemplates, ControlTemplates)
- Attachable Members. (Attached Properties in WPF/WinRT)
- Type Converters. Ability to convert an instance of one type to another implicitly (usually from values in XAML that come as strings).
# XAML examples
This is just an example of XAML that can be read with OmniXAML
```xml
<Window Width="300" Height="300"
xmlns="perspex"
xmlns:m="clr-namespace:TestApplication;Assembly=TestApplication">
<ScrollViewer>
<StackPanel>
<ListBox Items="{Binding Path=People}">
<ListBox.DataTemplates>
<XamlDataTemplate DataType="{Type TypeName=m:Person}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Image Source="github_icon.png" Height="60" />
<Button Grid.Column="1" Content="{Binding Path=Name}" />
</Grid>
</XamlDataTemplate>
</ListBox.DataTemplates>
</ListBox>
</StackPanel>
</ScrollViewer>
</Window>
```
Thanks to [Nicholas Blumhardt](https://twitter.com/nblumhardt) for his awesome project [Sprache](https://github.com/sprache/Sprache) that has introduced me in the world of parsers.