зеркало из https://github.com/AvaloniaUI/OmniXAML.git
Add XAML examples and complete description.
This commit is contained in:
Родитель
53447b8db0
Коммит
fe7aece9ba
46
README.md
46
README.md
|
@ -1,7 +1,7 @@
|
||||||
# OmniXAML
|
# 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
|
```csharp
|
||||||
foreach (var thing in life)
|
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.
|
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.
|
||||||
|
|
Загрузка…
Ссылка в новой задаче