Browse Source

Added a bit more to docs.

pull/478/head
Steven Kirk 11 years ago
parent
commit
da1aee675d
  1. 10
      docs/spec/styles.md
  2. 40
      docs/tutorial/from-wpf.md

10
docs/spec/styles.md

@ -49,6 +49,16 @@ As in CSS, controls can be given *style classes* which can be used in selectors:
<Button>I will not.</Button> <Button>I will not.</Button>
</StackPanel> </StackPanel>
Each control can be given 0 or more style classes. This is different to WPF
where only a single style can be applied to a control: in Perspex any number
of separate styles can be applied to a control. If more than one style affects
a particular property, the style closest to the control will take precedence.
Style classes can also be manipulated in code using the `Classes` collection:
control.Classes.Add("blue");
control.Classes.Remove("red");
## Pseudoclasses ## Pseudoclasses
Also as in CSS, controls can have pseudoclasses; these are classes that are Also as in CSS, controls can have pseudoclasses; these are classes that are

40
docs/tutorial/from-wpf.md

@ -40,6 +40,29 @@ 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 Perspex can also target interfaces and derived classes (which
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
so you need to place them from most-specific to least-specific as you would in
code.
## HierachicalDataTemplate
WPF's `HierarchicalDataTemplate` is called `TreeDataTemplate` in Perspex (as the
former is difficult to type!). The two are almost entirely equivalent except
that the `ItemTemplate` property is not present in Perspex.
## UIElement, FrameworkElement and Control ## UIElement, FrameworkElement and Control
WPF's `UIElement` and `FrameworkElement` are non-templated control base classes, WPF's `UIElement` and `FrameworkElement` are non-templated control base classes,
@ -79,12 +102,23 @@ reasons](http://www.codemag.com/article/1501091) for this, but briefly:
## Grid ## Grid
Perspex has a `Grid` panel just like WPF, however a common use of `Grid` in WPF Column and row definitions can be specified in Perspex using strings, avoiding
is to stack two controls on top of each other. For this purpose in Perspex you the clunky syntax in WPF:
can just use a `Panel` which is more lightweight than `Grid`.
<Grid ColumnDefinitions="Auto,*,32" RowDefinitions="*,Auto">
A common use of `Grid` in WPF is to stack two controls on top of each other.
For this purpose in Perspex you can just use a `Panel` which is more lightweight
than `Grid`.
We don't yet support `SharedSizeScope` in `Grid`. We don't yet support `SharedSizeScope` in `Grid`.
## ItemsControl
In WPF, `ItemsControl` and derived classes such as `ListBox` have two separate
items properties: `Items` and `ItemsSource`. Perspex however just has a single
one: `Items`.
## Tunnelling Events ## Tunnelling Events
Perspex has tunnelling events (unlike UWP!) but they're not exposed via Perspex has tunnelling events (unlike UWP!) but they're not exposed via

Loading…
Cancel
Save