Browse Source

Updated "from WPF" doc.

pull/766/head
Steven Kirk 10 years ago
parent
commit
d1295bb6c8
  1. 20
      docs/tutorial/from-wpf.md

20
docs/tutorial/from-wpf.md

@ -40,17 +40,6 @@ placed in a `DataTemplates` collection on each control (and on `Application`):
<ContentControl Content="{Binding Foo}"/> <ContentControl Content="{Binding Foo}"/>
<UserControl> <UserControl>
`ItemsControl`s don't currently have an `ItemTemplate` property: instead just
place the template for your items into the control's `DataTemplates`, e.g.
<ListBox Items="ItemsSource">
<ListBox.DataTemplates>
<DataTemplate>
<TextBlock Text="{Binding Caption}"/>
</DataTemplate>
</ListBox.DataTemplates>
</ListBox>
Data templates in Avalonia can also target interfaces and derived classes (which Data templates in Avalonia can also target interfaces and derived classes (which
cannot be done in WPF) and so the order of `DataTemplate`s can be important: cannot be done in WPF) and so the order of `DataTemplate`s can be important:
`DataTemplate`s within the same collection are evaluated in declaration order `DataTemplate`s within the same collection are evaluated in declaration order
@ -92,13 +81,8 @@ referred to using the `{StyleResource}` markup extension both inside and outside
styles. styles.
For non-style-related resources, we suggest defining them in code and referring For non-style-related resources, we suggest defining them in code and referring
to them in markup using the `{Static}` markup extension. There are [various to them in markup using the `{Static}` markup extension. To read more about the reasoning for this,
reasons](http://www.codemag.com/article/1501091) for this, but briefly: see [this issue comment](https://github.com/AvaloniaUI/Avalonia/issues/462#issuecomment-191849723).
- Resources have to be parsed
- The tree has to be traversed to find them
- XAML doesn't handle immutable objects
- XAML syntax can be long-winded compared to C#
## Grid ## Grid

Loading…
Cancel
Save